This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: gcc/g++ not ISO compliance?
- From: Vincent Rivellino <vrivelli at cs dot vt dot edu>
- To: Volker Reichelt <reichelt at igpm dot rwth-aachen dot de>
- Cc: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 10 Jan 2003 10:30:34 -0500 (EST)
- Subject: 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
>
>