今天有人问我空类的sizeof会输出什么,把我难住了,特地记录一下。 我在ubuntu使用g++进行了测试。 代码如下: #include <iostream> class Test{}; int main(int argc, char *argv[]) { Test a, b; std::cout << "sizeof(test) is: " << sizeof(Test) << std::endl; std::cout << "the addr of a is: " << &a << std::e...