Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
CopperWing
· 8y ago · 0 comments
In C++, nullptr.
Comments
[–]
cjs_2
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
Literal zero in a pointer context is interpreted by the compiler to mean "the null pointer." The compiler then compiles the null pointer into the code.