DIP 1025--Dynamic Arrays Only Shrink, Never Grow--Community Review Round 1

Jab jab_293 at gmall.com
Tue Nov 12 03:35:04 UTC 2019


On Tuesday, 12 November 2019 at 03:08:28 UTC, Walter Bright wrote:
> On 11/11/2019 7:24 AM, jmh530 wrote:
>> malloc is also only allowed in @system code.
>
> Although malloc() is marked as @system, it actually is @safe. 
> It's free() that needs to be @system.

You can only really consider malloc @safe cause "void*" is 
completely useless in @safe, and casting it to a different type 
is what is unsafe. By those constraints free() could also be 
considered "safe". If you do cast the pointer to another type, 
then both are not safe.


More information about the Digitalmars-d mailing list