Next: Buffer Overruns and Subscript Errors, Previous: Preprocessor Arithmetic, Up: Portable C and C++ Programming [Contents][Index]
Most modern hosts reliably fail when you attempt to dereference a null pointer.
On almost all modern hosts, null pointers use an all-bits-zero internal
representation, so you can reliably use memset
with 0 to set all
the pointers in an array to null values.
If p
is a null pointer to an object type, the C expression
p + 0
always evaluates to p
on modern hosts, even though
the standard says that it has undefined behavior.