On 20.01.2017 01:36, Stefan Ram wrote:
> "Alf P. Steinbach" <
alf.p.stein...@gmail.com> writes:
>> No no, the placement new /reinitializes/ the storage, after the pseudo
>> destructor call has allegedly put an indeterminate value there.
>>> (i.e., uninitialized) again, »new( &x )int;«.
>
> I assumed that this is the difference between
>
> new( &x )int( 2 );
>
> and
>
> new( &x )int;
>
> . The former reinitializes, but the second one not.
>
> Possibly this might be relevant paragraphs:
>
> »18 A new-expression that creates an object of type T
> initializes that object as follows:
>
> (18.1) --- If the new-initializer is omitted, the object
> is default-initialized (8.6).
>
> [Note: If no initialization is performed, the object has
> an indeterminate value. ---end note ]«
>
> 5.3.4 New [
expr.new]
>
Oh you're right. Sorry.
>> I think that's an unnecessarily complicated formal view of things.
>
> That was the point of her talk: Formalizing
> assumptions we usually take for granted.
Well, tell her she'd better make sure all the examples are correct, or
at least work with clang (in the old days we'd use Comeau).
E.g. Marshall Cline once did that for all the examples in the FAQ.
Cheers!
- Alf