Detect platforms where memset(0) doesn't set doubles to 0.0.

This is allowed by the C statndard, which permits you to represent
doubles any way you like, but in practice we have some code that
assumes that memset() clears doubles in structs.  Noticed as part of
7802 review; see 8081 for more info.
This commit is contained in:
Nick Mathewson
2013-01-29 17:38:15 -05:00
parent a0351311ae
commit 73d605b0f7
4 changed files with 40 additions and 0 deletions
+5
View File
@@ -74,6 +74,11 @@
#error "It seems your platform does not represent NULL as zero. We can't cope."
#endif
#ifndef DOUBLE_0_REP_IS_ZERO_BYTES
#error "It seems your platform does not represent 0.0 as zeros. We can't cope."
#endif
#if 'a'!=97 || 'z'!=122 || 'A'!=65 || ' '!=32
#error "It seems that you encode characters in something other than ASCII."
#endif
+3
View File
@@ -151,6 +151,9 @@
/* Define to 1 iff NULL is represented by a 0 in memory. */
#define NULL_REP_IS_ZERO_BYTES 1
/* Define to 1 iff memset(0) sets doubles to 0.0 */
#define DOUBLE_0_REP_IS_ZERO_BYTES 1
/* Name of package */
#define PACKAGE "tor"