Re:GCC 13 Supports New C2x Features, Including Nullptr, Enha...
by LegionMammal978 on Monday May 15, 2023 @02:12PM
(#35952243)
In C, the integer 0 is explicitly defined to convert to a null pointer for all assignments, casts, comparisons, etc., regardless of what the pointer's "actual" value is. The only time where you can see that a null pointer doesn't have numeric value 0 is when you manipulate its object representation with memset, memcpy, etc. The compiler is also at liberty to return whatever it wants when you convert a null pointer to an integer, except that converting it back must produce a null pointer (if it's at least as wide as intptr_t).
[ Parent
| on HN ]
There are no comments on this comment yet.