Kactung
Kactung

Reputation: 730

Am I failing to follow the standard?

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 that flag and initialize each member of the structure separately?

Thank you.

Upvotes: 1

Views: 254

Answers (1)

Mark B
Mark B

Reputation: 96233

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.

Upvotes: 9

Related Questions