On Mon, Sep 21, 2009 at 4:56 PM, Ian Lance Taylor <i...@google.com> wrote: > Florian Weimer <f...@deneb.enyo.de> 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 reason that g++ should reject your sample program?
Yes: there is no obvious reason for gratuitous incompatibility in semantics. > > Because of the existence of operator new[], "new char[a][b]" quite a bit > harder to understand than your code is. But, new char[4][3] is OK. FWIW, I do really find the VMT version far harder to understand. > > Ian >