@BRIAN_____ That's gotta be true in C++ (I think), but NULL is defined differently there.
-
-
-
@stevecheckoway Comparison of the form ptr == 0 is a special case in C++. But, that's not the same as (uintptr_t)pointer == 0. -
@BRIAN_____@stevecheckoway NULL is not required to be void*. C99 §6.3.2.3/3. So ptr == 0 is also valid C. -
@sevenps@BRIAN_____ Yep. Entry in the C FAQ too http://c-faq.com/null/nullor0.html … -
@stevecheckoway@sevenps "It is only in pointer contexts that NULL and 0 are equivalent". (uintptr_t)(void *p)0 == 0 isn't pointer context -
@BRIAN_____@sevenps Agreed, but (uintptr_t)NULL == 0 also isn't a pointer context (in C++) so there, it should just be comparing 2 integers -
@stevecheckoway@sevenps Yes, exactly. But, is the integer value of (uintptr_t)NULL the value 0? -
@BRIAN_____@sevenps Hmm. Thinking further, I think#define NULL nullptr is valid, so maybe it's implementation-defined in C++ too. Fun! - 1 more reply
New conversation -
-
-
@BRIAN_____ Good question. There are several related questions. E.g., does every type have only one null pointer? -
@BRIAN_____ Does all-zero-bits pointer is a null pointer? I.e., will memset(, 0, ) or calloc give you a null pointer? -
@BRIAN_____ (Related to to [13/15] in https://www.cl.cam.ac.uk/~pes20/cerberus/notes50-2015-05-24-survey-discussion.html … . For POSIX see http://austingroupbugs.net/view.php?id=940 .) -
@BRIAN_____ Is casting non-constant integer zero gives null pointer? (This is [12/15] in https://www.cl.cam.ac.uk/~pes20/cerberus/notes50-2015-05-24-survey-discussion.html … .) -
@BRIAN_____ BTW for a discussion of NULL definition please see http://ewontfix.com/11/ . -
@BRIAN_____ http://c-faq.com/null/machexamp.html … is quite entertaining too.
End of conversation
New conversation -
-
-
@BRIAN_____ It's been a while since I read the standard but I believe, yes, comparing with the bitpattern 0 is a specially supported case.Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.