It can be used as a compile-time constant, which is possible only if it is an operator and not a function. For example:
union foo { int i; char c[sizeof(int)]; };
Syntactically, if it was not an operator, then it should have been a preprocessor macro, since functions cannot accept types as arguments. This would be a difficult macro to implement, since sizeof can accept both types and variables as an argument.
John Kugelman Sep 08 '09 at 12:02 2009-09-08 12:02
source share