4 ms·
I looked into this. #include <iostream> int main() { std::cout << "sizeof(NULL) = " << sizeof(NULL) << '\n'; } Compiling with both g++ 6.2.1 and clang++ 3.
by fnj 10y ago
I looked into this.
#include <iostream>
int main()
{
std::cout << "sizeof(NULL) = " << sizeof(NULL) << '\n';
}
Compiling with both g++ 6.2.1 and clang++ 3.9.1 with -std=c++11 in both cases gives:
sizeof(NULL) = 8
AFAICT, NULL should not even be defined at all in C++ 11; certainly if you include neither <stddef.h> nor <stdlib.h> nor <cstddef> nor <cstdlib>.
I could never get it to compile on x86_64 linux without saying 8.
Bottom line: NULL works in the execlp call, whether from C or from C++. nullptr would be cleaner.