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]

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]