D not considered memory safe

Timon Gehr timon.gehr at gmx.ch
Thu Jul 11 00:02:27 UTC 2024


On 7/10/24 23:47, Walter Bright wrote:
> On 7/8/2024 5:37 PM, Timon Gehr wrote:
>> Templates are inferred by default:
> 
> Thanks for the explanation. It's just @safe templates cannot call 
> @system functions.
> ...

No. That's not it. A template that calls a system function is just not 
`@safe`, and is inferred that way.

The issue is that there is no way to say "@safe by default, keep 
inference enabled", you can only say "@safe, disable inference".

Therefore, you are either stuck with `@system` by default or you are 
left with no `@safe` inference.

> Essentially, if you have mixed safe functions and system functions, 
> unannotated, and then you apply Shazaam! Make it all @safe! then yes, 
> you're going to have to deal with the code that cannot safe.
> 
> I don't see this as a problem. It's the whole point.

That's the point of writing `@safe:`. This is however not what is needed 
in this context.

The problem is not with `@safe:`, it is that there is a missing feature.


More information about the Digitalmars-d mailing list