D defined behavior

Dennis dkorpel at gmail.com
Mon Apr 27 18:59:22 UTC 2020


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


More information about the Digitalmars-d mailing list