Jason Moxham on Sun, 28 Jun 2009 02:27:59 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: Pari svn on MSVC |
On Saturday 27 June 2009 15:39:09 Bill Allombert wrote: > On Sat, Jun 27, 2009 at 01:07:15AM +0100, Jason Moxham wrote: > >> Does that cause a compiler failure ? Even gcc 2.95 handles that. > > > > yes > > eg jay.c is > > ---------- > > int main(void) > > { > > const int n=10; > > long a[n]; > > return 0;} > > ------------ > > > > cl jay.c > > Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.21022.08 for > > 80x86 > > Copyright (C) Microsoft Corporation. All rights reserved. > > > > jay.c > > jay.c(4) : error C2057: expected constant expression > > jay.c(4) : error C2466: cannot allocate an array of constant size 0 > > jay.c(4) : error C2133: 'a' : unknown size > > OK, what is the C standard supported by this compiler ? > Can it be switched to C99 mode ? > > (I do not know whether this code is C89 compliant. It is certainly > C99 compliant since C99 allows array size to be computed at run-time) > > Cheers, > Bill. MSVC is apparently a C89 for plain C , and a C99 for C++ , so we could pretend that the files are c++ files to compile them under C99 , a bit risky perhaps. I expect const int a , is not classed as a compile time constant in C89. MSVC does support a few thing not in C89 such as // comments , long long . Being MSVC , there is nothing we can do about it ;) Jason