Variable Length Arrays (Not) In Visual C++

The C99 language standard added support for variable length arrays (VLAs):

 void foo(int len){  float myArray[len];  ... } 

In porting some C# code to C++, I had a method signature like that, so I tried to use a VLA. Sadly, VC++ 2005 produces “error C2057: expected constant expression,” “error C2466: cannot allocate an array of constant size 0,” and “error C2133: ‘myArray’ : unknown size”. I’ve confirmed that this is a compliance thing: the code works with

gcc -std=iso9899:1999

. Pity.>