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

2009-09-22 Thread Florian Weimer
* Gabriel Dos Reis: >>> Is this intentional?  The equivalent "new char[a][b]" is rejected (as >>> required by the C++ standard). >> >> Is there any reason that g++ should reject your sample program? > > Yes: there is no obvious reason for gratuitous incompatibility in > semantics. That, and it re

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

2009-09-21 Thread Gabriel Dos Reis
On Mon, Sep 21, 2009 at 4:56 PM, Ian Lance Taylor wrote: > Florian Weimer writes: > >> 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[

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

2009-09-21 Thread Ian Lance Taylor
Florian Weimer writes: > 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). Is there any r