back

by layer8·5y ago·view on hn ↗
An integer constant expression is a syntactical construct, not a runtime entity. The C standard provides no guarantee that bytes (chars) with value zero can be read from memory as a null pointer.
1 comments
wait what? my C is a bit rusty but when would reading 0 from memory & casting to a (void?) pointer type ever != NULL?
C implementations are allowed to use a not-all-bits-zero representation for null pointer values. They are merely required to convert integer constant expressions with value zero to a null pointer value — regardless of how the resulting null pointer value is represented in memory.

See also these FAQs:

http://c-faq.com/null/machnon0.html

http://c-faq.com/null/machexamp.html