gcc
will warn about the following example code:
struct someStruct {
char c;
int i;
};
int main() {
someStruct s { 'a', 3 };
return 0;
}
warning: extended initializer lists only available with -std=c++0x or -std=gnu++0x
I want to make my code compatible to older compilers having no C++11 support. Now when I try to compile it with either -std=c++98
or even -ansi -pedantic
it still issues the same warning and compiles.
Is this a compiler bug or am I missing something?
你错过了一个=
:
someStruct s = { 'a', 3 };
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.