Hacker News new | ask | show | jobs
by zlynx 2393 days ago
A fun one relating to 64-bit and NULL in varargs:

If your system defines NULL as 0, which is legal in C++, then NULL in the vararg list only pushes an int-sized (4 bytes) zero, and the vararg reader pulls a pointer-sized (8 bytes) value, which may or may NOT equal zero because of the 4 extra bytes...

1 comments

If using modern c++ you should use nullptr instead
If using modern C++, you shouldn't be using varargs either.