array new-expressions: proposal

Matt Austern austern at isolde.engr.sgi.com
Mon Jan 24 23:21:49 UTC 2000


On Jan 24,  7:55pm, Martin von Loewis wrote:
> Subject: Re: array new-expressions: proposal
> > We could just put in 16-byte padding for all types, but I think that's
> > a waste.  There's no reason to do it.  It's just as easy to use 8-
> > byte padding in general, and 16 only when we have to.
>
> I'd like to repeat my proposal that there is *no padding* if the type
> does not have a destructor. In that case, you could use the outcome of
> operator new directly for arrays of char and unsigned char; the
> multiple mentioned in 5.3.4/10 would be 0.
>
> Regards,
> Martin
>-- End of excerpt from Martin von Loewis

That's an interesting idea, and it's yet another example of why
there really might be good reason for the standard to have granted
implementors as much freedom as it did.  It's certainly tempting
not to waste 8 bytes when we don't have to.

One of the things I'll have to think about is whether there are
any reasons that users might want to have that array count for
their own versions of placement new, provided that they're willing
to write nonportable code.  (And if they're not willing to write
nonportable code, then they shouldn't be using array placement
new.)

			--Matt




More information about the cxx-abi-dev mailing list