4 ms·
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
by layer8 6y ago
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.
- adamrezich 6y agowait what? my C is a bit rusty but when would reading 0 from memory & casting to a (void?) pointer type ever != NULL?
- layer8 6y agoC 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/machnon0.html http://c-faq.com/null/machexamp.html http://c-faq.com/null/machexamp.html