in g++, NULL is defined as __null, in 64-bit case, __null is 8 bytes. such as:
printf("sizeof(__null):%d, sizeof(0):%d\n", sizeof(__null), sizeof(0));
sizeof(__null):8, sizeof(0):4
however, where is __null defined?
The implementation of __null
is as a G++ internal. You won't find it in a header file or anything like that. You can find some explanation of the logic here but the basic idea is that it's the simplest way to ensure NULL is seen as a pointer first.
Basically, the internal does what you would naively expect reinterpret_cast<void *>(0)
to do.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With