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?


Hi,

While the code may not be valid ISO C++, it *is* valid ISO C, as in the
ISO/IEC 9899 "C99" standard of 1-Dec-1999. Section 6.7.5.2 specifically
allows "variable" arrays.

This is one of many C99 changes that are incompatible with C++ (which
incorporates the older, now-deprecated C89 standard).

..Scott

> -----Original Message-----
> From: gcc-bugs-owner@gcc.gnu.org [mailto:gcc-bugs-owner@gcc.gnu.org]On
> Behalf Of Vincent Rivellino
> Sent: Friday, January 10, 2003 09:59
> To: gcc-bugs@gcc.gnu.org
> Subject: gcc/g++ not ISO compliance?
>
>
> 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.
>
>


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