D not considered memory safe
Timon Gehr
timon.gehr at gmx.ch
Sat Jul 20 16:10:25 UTC 2024
On 7/19/24 20:10, Walter Bright wrote:
> On 7/17/2024 12:17 PM, Timon Gehr wrote:
>> On 7/15/24 20:24, Walter Bright wrote:
>>> Those are good suggestions, but I've been trying to make dmd @safe
>>> now for a while. With all the inheritance going on, and the flow
>>> graph cycles, your suggestions are not workable.
>>>
>>
>> What I suggested is in fact workable even for code with a big cyclical
>> call graph.
>
>
> I am not understanding how.
You are marking functions as `pragma(local_safe)` one by one while you
fix any errors that pop up. The code remains compilable for the entire
time. Then once the entire cycle has been fixed, you can replace
`pragma(local_safe)` by `@safe`.
I guess in practice you'd want some `@system` calls to be flagged while
you port, but not others, so some design work may still be needed.
In any case, if I had to port a big codebase to `@safe`, it is likely I
would just fork the compiler and create some tooling to help with the job.
More information about the Digitalmars-d
mailing list