This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gcc/g++ not ISO compliance?


Thanks for the insight.  I knew there had to be a logical explanation
behind this.

-Vince


On Fri, 10 Jan 2003, Volker Reichelt wrote:

> Variable sized errors are a GCC extension, see
>
> http://gcc.gnu.org/onlinedocs/gcc-3.2.1/gcc/Variable-Length.html#Variable%20Length
>
> If you want to have strict ISO compliance you can specify the command line
> option "-pedantic" which gives you are warning
>
> code.cc: In function `int main()':
> code.cc:9: warning: ISO C++ forbids variable-size array `array'
>
> or "-pedantic-errors" which gives you an error
>
> code.cc: In function `int main()':
> code.cc:9: error: ISO C++ forbids variable-size array `array'
>
> for the following code:
>
> -----------------------------snip here------------------------
> #include<iostream>
>
> using namespace std;
>
> int main()
> {
>   int i;
>   cin>>i;
>   int array[ i ];  // i is dynamic
>   cout<<endl;
>   for (int j=0; j<i; j++) // see if there is any run-time error
>   cout<<array[j]<<endl;
>
>   return 0;
> }
> -----------------------------snip here------------------------
>
> Regards,
> Volker
>
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]