C ++ array initializers warnings

I declared and initialized a constant char array inside the class:

class grid {
    const char test[11] = {'s', 'e', '1', '2', '3', '4', '5', '6', '7', '8', '9'};

My code works, but I keep getting compiler warnings:

non-stationary data element initializers available only with C ++ 11

and

extended initializer lists are only available with C ++ 11

I know this is not a problem , because I am compiling the C ++ 11 standard, but I'm wondering what pre C ++ 11 is about my code.

I hope someone can give me some insight and suggest what I can do to make this C ++ 98 code “friendly”.

Also as requested by my compiler command:

> g++ -o test main.cpp
+3
source share
2 answers

-std=c++11 ( gcc clang). , ++ 98 .

, ++ 11 , , .

:

, , . , , ++ 11, (, , ) , gcc4.6, ++ 11, , , , , (, , ).

-std=c++11 " ++ 11, , ++ 11". , .

+2

++ 98, .

+2

Source: https://habr.com/ru/post/1546428/


All Articles