C++: variable length arrays and operator new[]

Florian Weimer fw@deneb.enyo.de
Sun Sep 20 09:59:00 GMT 2009


G++ currently accepts the following code:

char *
alloc(unsigned a, unsigned b)
{
  typedef char array[a];
  return &**(new array[b]);
}

Is this intentional?  The equivalent "new char[a][b]" is rejected (as
required by the C++ standard).



More information about the Gcc mailing list