最近我在<QMap>
标题中找到了这样的代码。
#include <iostream>
class Something
{
public:
int a : 42; // What does this mean?
};
int main()
{
Something something;
std::cout << something.a << std::endl;
return 0;
}
它似乎不是初始化,因为程序输出0
。
我也收到一个奇怪的警告:
main.cpp:6: warning: width of 'Something::a'
exceeds its type [enabled by default]