How can I get g ++ to fully satisfy the iso C ++ standard

I am writing some simple C ++ code to test a C ++ grammar. But when I use g ++ to compile it, the result does not seem to conform to the iso standard. How can I let g ++ fill satisfactory C ++ iso. eg:

#include<iostream> using namespace std; int main(){ int s=10; int k[s]; cout<<sizeof(k)/sizeof(int)<<endl; return 0; } 

In the above program, when I use the following command to compile it. She did not display any errors, and "s" is a variable. According to my information, it should show an error.

  g++ -Wall -ansi -std=c++11 mytest.cpp.cpp -o mytest 

And result 10 seems to work well. Can someone tell me how can I let g ++ show me some errors.

+5
source share

All Articles