This is the mail archive of the
mailing list for the GCC project.
Re: Vector new bug ??
- To: Florian Weimer <fw at deneb dot enyo dot de>
- Subject: Re: Vector new bug ??
- From: Carlo Wood <carlo at alinoe dot com>
- Date: Fri, 12 Oct 2001 15:44:57 +0200
- Cc: Günter Neiß <gneiss at schoenhofer dot de>, gcc at gcc dot gnu dot org
- References: <3BC6B6FE.69BC3A06@schoenhofer.de> <email@example.com>
On Fri, Oct 12, 2001 at 12:10:40PM +0200, Florian Weimer wrote:
> Günter Neiß <firstname.lastname@example.org> writes:
> > t * p = new T[ size ];
> > Everything works fine, as long as 'size' isn't 0.
> This is indeed a bug:
> | When the value of the expression in a direct-new-declarator is zero,
> | the allocation function is called to allocate an array with no
> | elements. The pointer returned by the new-expression is non-null.
> | [Note: If the library allocation function is called, the pointer
> | returned is distinct from the pointer to any other object. ]
> ISO/IEC 14882:1998, 5.3.4(7).
Weird that this is allowed, after all - zero elements for a normal
array isn't allowed either.
Carlo Wood <email@example.com>