NULL v. zero
Posted Jul 15, 2004 22:02 UTC (Thu) by
sir99 (guest, #3286)
In reply to:
NULL v. zero by Ross
Parent article:
NULL v. zero
If NULL is defined as (void*)0, then neither of those is legal C++. It seems that gcc special-cases NULL so that it can be treated as both an integer and a pointer. Further, only an expression that evaluates to 0 at compile-time can be implicitly cast to a pointer; no other integer can be.
AIUI, the lhs doesn't determine how the rhs is evaluated. The rhs is evaluated independently and then promoted to the type of the lhs.
(
Log in to post comments)