Is sizeof in C++ evaluated at compilation time or run time?
For example result of this code snippet depends on which machine: the compiler machine or the machine executable file works?
sizeof(short int)
Solution 1:
sizeof
is a compile time operator.
Solution 2:
It depends on the machine executing your program. But the value evaluates at compile time. Thus the compiler (of course) has to know for which machine it's compiling.