Does sizeof evaluate at compile-time or runtime?
问题 I am confused about the evaluation time of sizeof operator. When does the sizeof operator get evaluated? Does its evaluation time (compile-time or runtime) depend on the language (C? C++?)? Can we use sizeof in case of objects created at runtime in C++? 回答1: In almost all cases, sizeof is evaluated based on static type information (at compile-time, basically). One exception (the only one, I think) is in the case of C99's variable-length arrays (VLAs). 回答2: Almost always compile time. But the