开发者

Am I failing to follow the standard?

开发者 https://www.devze.com 2023-01-05 08:16 出处:网络
If I have something like this: MyStruct clip; clip = {16, 16, 16, 16}; I get the following warning from the compiler:

If I have something like this:

MyStruct clip;

clip = {16, 16, 16, 16};

I get the following warning from the compiler: warning: extended initializer lists only available with -std=c++0x or -std=gnu++0x

If I active -std=c++0x in the compiler, it does not give any warning. But I'm not sure if I am following the standard. So should I deactivate 开发者_StackOverflow中文版that flag and initialize each member of the structure separately?

Thank you.


For initialization you should be able to use MyStruct clip = {16, 16, 16, 16}; but as you discovered in the current C++ standard you can't assign to a bracketed list. In C++1x you can use the extended syntax.

0

精彩评论

暂无评论...
验证码 换一张
取 消