|
![](/i/fill.gif) |
By my reading, neither C nor C++ guarantee the following:
union {
long x;
char* y;
} xyz;
xyz.y = NULL;
printf("%ld\n", xyz.x);
Neither C nor C++ guarantees that'll be zero (assuming
sizeof(char*)==sizeof(long)). In other words, neither guarantees that the
bit pattern in memory for NULL is actually all zeros, right?
So using memset() to clear a structure to 0 that contains pointers isn't
guaranteed to be portable to something like the AT&T 3B2, where NULL != 0x0
in memory?
I looked, but all I found were references to "null pointer value", and not
any bit patterns.
--
Darren New, San Diego CA, USA (PST)
"We'd like you to back-port all the changes in 2.0
back to version 1.0."
"We've done that already. We call it 2.0."
Post a reply to this message
|
![](/i/fill.gif) |