Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
cjs_2
· 8y ago · 0 comments
What would you suggest using instead? The actual (void *) 0?
Comments
[–]
CopperWing
8y ago
In C++, nullptr.
[–]
cjs_2
OP
8y ago
And in C?
[–]
craigching
8y ago
In C, always use 0 and check for 0, it's the only safe way. For C++, it depends on the standard you're using.
[–]
fanf2
8y ago
Except when calling a varargs function, when you need to cast to the correct pointer type
[–]
guipsp
8y ago
But 0 isn't always null right?
[–]
cjensen
8y ago
Prior to nullptr, generally I used literal 0. In those cases which require disambiguation, I used (void * ) 0.
[–]
Fronzie
8y ago
In C++ it'd be nullptr.