NULL v. zero
Posted Jul 15, 2004 22:45 UTC (Thu) by
ikm (subscriber, #493)
In reply to:
NULL v. zero by kamil
Parent article:
NULL v. zero
I guess you can always safely pass NULL, as it would be declared as a plain 0 only in case it really physically is a plain 0. In any other case it would be ((void *)0). Any sane library would always declare NULL as ((void *)0), because it is the compiler that always knows the actual physical value for sure :)
Of course, all other values for NULL would be incorrect, as it was explained in my initial posting. One can not define NULL as 0xFFFFFFFF, for example, as it would not qualify as a null pointer constant.
Thanks for providing the example, that clarified things a bit!
(
Log in to post comments)