Brett W. McCoy wrote: > On 8/9/06, *Fernando Azaldegui* <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> wrote: > > The correct output is Visual C++. You can't allocate an array with > an unconstant variable, the way to do that is with dynamic > allocation (new, malloc,...). > > > I think the issue is gcc/g++ (which is what DevC++ uses) has some > aspects of C99 already incorporated into the compiler, so some C99 > things might work (like using non-const values to declare a static > array), and some might not. Yay for non-portability.... > > Hardy Huang escribió: > > Hi, > The following code produced different output from two different > compiler which is Dev C++ and Visual C++ 2005. > > int n; > cin >> n; > list<int> myList[n]; > > Dev C++ compiled with no problem but visual C++ 2005 failed to > compile > with error with the following error messages: > error C2057: expected constant expression > error C2466: cannot allocate an array of constant size 0 > error C2133: 'myList' : unknown size > > Which one is the true output? > Thx in advance > > > > > -- > Brett McCoy: Programmer by Day, Guitarist by Night > http://www.alhazred.com > http://www.cassandrasyndrome.com <http://www.cassandrasyndrome.com> > http://www.revelmoon.com > ._,_.___ >
I'm not aware of C99 support being turned on as default in GCC, but here's more information. http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/Standards.html#Standards. To unsubscribe, send a blank message to <mailto:[EMAIL PROTECTED]>. Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/c-prog/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
