gcc/g++ not ISO compliance?

Vincent Rivellino vrivelli@cs.vt.edu
Mon Jan 13 05:17:00 GMT 2003


I'm not sure if this is a bug or a feature, but I wanted to report it (and
see what the response was).

There is a thread on a university class discussion board that I
administrate for the Computer Science Department at Virginia Tech that
discusses dynamic array dimensions.

Here's the thread: https://forum.cs.vt.edu/topic_show.pl?tid=4731

Would anyone care to give me an explanation?

Thanks,
Vince



PS: The two posts that most interest me:


> See ISO Standard Item 8.3.4.1; the dimension if present must be a
> constant expression.  Period.  No exceptions.  If g++ 3.2 accepts this
> code then it is out of compliance.


> FYI, I tried to compile and run
> this code (with proper header of course):
>
> 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;
>
> It works perfectly.



More information about the Gcc-bugs mailing list