5

I am writing some simply c++ code to test the c++'s grammer.But when i use g++ to compile it, the result seems to didn't comply the iso standard.how can i let g++ full of satisfy iso c++.my code like this:

#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 below command to compile it.It did't show any error,while 's' is variable .According to my knowledge ,it should show error.

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

And the result is 10 ,it seems to work good. Can anyone tell me how can I let g++ show some errors to me .

0 Answers0