On 8/9/06, Fernando Azaldegui <[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.revelmoon.com
__._,_.___

To unsubscribe, send a blank message to <mailto:[EMAIL PROTECTED]>.




SPONSORED LINKS
C programming language Programming languages Computer programming languages
Java programming language


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to