Prevent self-comparison without taking the address

Dom DiSc dominikus at scherkl.de
Fri Jul 26 07:35:39 UTC 2024


On Thursday, 25 July 2024 at 15:40:29 UTC, Nick Treleaven wrote:
> On Thursday, 25 July 2024 at 15:06:35 UTC, IchorDev wrote:
>> I think your function most likely has a safe interface, so it 
>> can be marked as `@trusted` as-per [the 
>> spec](https://dlang.org/spec/function.html#safe-interfaces).
>
> Just to mention that with -dip1000, taking the address of 
> variables is allowed, so the function would be @safe.

Thanks for all the good answers.
So the solution for me is -dip1000.

Marking something @trusted that the compiler should be able to 
check to be @safe is not so good, as it increases the review 
effort significantly and unneccessarily.


More information about the Digitalmars-d-learn mailing list