[cfe-dev] Variable length arrays are not permitted in C++

Rene Rebe rene at exactcode.de
Tue Feb 16 03:21:06 PST 2010


Hi all,

starting to play with Clang++ I notices this (building our Open Source ExactImage), currently on x86_64, T2 Linux:

lib/Colorspace.cc:442:22: error: variable length arrays are not permitted in C++
  uint8_t gray_lookup[vmax];

the code is straight forward variable length array, like:

..
  const int vmax = 1 << bps;
  uint8_t gray_lookup[vmax];

The error already indicates it is intentionally disabled in clang++ for C++

Even old (3.x?) versions of G++ happily accept this.

Is there an std=c99 like option to allow this in Clang++? Maybe it should accept it by default and warn that it is not portable, GNU extension (but I think present in C++0x)?

René

-- 
  René Rebe, ExactCODE GmbH, Jaegerstr. 67, DE-10117 Berlin
  http://exactcode.com | http://t2-project.org | http://rene.rebe.name





More information about the cfe-dev mailing list