Re: NULL and zeros



Christopher Layne said:

Richard Heathfield wrote:
[defensive programming yadda yadda]

I meant it is *implied* and was not written because it wasn't relevant to
the discussion at hand.

I understood what you meant by "implied", and my previous answer to that
point remains valid IMHO.

You clipped my last segment.

Oops.

If a machine expressed integer 0 as all 1 bits internally, and I called
memset(&object, 0, sizeof(object)); that's going to result in object set
to all 0 bits?

Yes, it must. The machine's bizarre internal representation does not excuse
the implementation from its obligations. The semantics of memset(&object,
0, sizeof(object)) is "starting at the address indicated by object, set
sizeof(object) bytes to the value (unsigned char)0". If object has integer
type then that process must have the effect of setting object's value to 0.
If it has some other type, however, there is no such requirement.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
.