Second Draft: Placement New Expression

Paul Backus snarwin at gmail.com
Wed Nov 20 00:54:11 UTC 2024


On Tuesday, 19 November 2024 at 21:18:53 UTC, Richard (Rikki) 
Andrew Cattermole wrote:
> On 20/11/2024 8:08 AM, Paul Backus wrote:
>> It would not be @safe, because there is no way the compiler 
>> can be sure that the void[] returned from allocate will not be 
>> aliased by other pointers/references/slices. The programmer 
>> would have to verify that for each individual allocator 
>> implementation, and use @trusted once they had done so.
>
> If there is anything like that is occurring outside of an 
> allocator, or a misbehaving allocator, what expression you used 
> to call an allocator is irrelevant, you have significantly 
> bigger problems to attend to.
>
> At the very least you will have program corruption, at best a 
> crash.

I agree. If someone makes a mistake here, it could lead to 
program corruption. That's exactly why it can't be @safe.


More information about the dip.development mailing list