On Tuesday, 19 November 2024 at 03:47:09 UTC, Walter Bright wrote:
>as the first draft did not survive the implementation:
I feel the need to point out that the proposed grammar puts another spoke in my wheel for primary type syntax: What is new ( … ) ( … )
?
Could be new(buffer) (Type)
(with implicit ()
arguments).
Could be new (Type)(CtorArg)
.
The issue is that the buffer is not distinguished. A simple solution would be to delineate the buffer with in
:
struct S { float d; int i; char c; }
void[S.sizeof] buffer = void;
S* ptr = new in(buffer) S(1, 2, 3);
// or
S* ptr = new S(1,2,3) in buffer;