D defined behavior

Arine arine1283798123 at gmail.com
Mon Apr 27 19:57:09 UTC 2020


On Monday, 27 April 2020 at 18:59:22 UTC, Dennis wrote:
> On Monday, 27 April 2020 at 18:21:45 UTC, Arine wrote:
>> D has UB even in @safe. @safe doesn't mean there's no UB, it 
>> simply means it is memory safe. This will print both true and 
>> false:
>
> Note that @safe is defined to have no undefined behavior.
>
>> Safe functions are functions that are statically checked to 
>> exhibit no possibility of undefined behavior. Undefined 
>> behavior is often used as a vector for malicious attacks.
>
> https://dlang.org/spec/function.html#function-safety
>
> Anytime it there is UB in a @safe function, it's a bug. The 
> example you posted in particular is filed under 
> https://issues.dlang.org/show_bug.cgi?id=20148

There's lots of bugs filed there. A lot of them aren't valid. No 
one's confirmed whether that actually even is a bug. It is 
working as intended, otherwise the fix is rather simple.


More information about the Digitalmars-d mailing list