原文:http://blog.sina.com.cn/s/blog_7c983ca60100yfdv.html#SinaEditor_Temp_FontName (1) sizeof是操作符,不是函数. MSDN:The sizeof keyword gives the amount of storage, in bytes, associate with a variable or a type(including aggregate types). This keyword ret…
对于sizeof(类或对象)这种形式,如classA1{ public: int a; static int b;A1();~A1();}sizeof计算类或对象在栈中分配的大小,类或对象的静态变量存放在全局数据域,是不会计算在内的,sizeof(A1)=4; 而int main(){ static int a=2; cout<<sizeof(a)<<endl;cout<<sizeof(a=8)<<endl;cout<<a<<end…