www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: Safety, undefined behavior, safe, trusted

reply Jason House <jason.james.house gmail.com> writes:
Walter Bright Wrote:

 Jason House wrote:
 I posted in the other thread how casting to immutable/shared can be
 just as bad. A leaked reference prior to casting to immutable/shared
 is in effect the same as casting away shared. No matter how you mix
 thread local and shared, or mutable and immutable, you still have the
 same undefined behavior

Not undefined, it's just that the compiler can't prove it's defined behavior. Hence, such code would go into a trusted function.

Might not be defined is still undefined as far as safeD is concerned. I'll be happy if you simply list casting to shared and immutable when listing what isn't allowed in safe functions (and not just casting it away.
Nov 05 2009
parent Walter Bright <newshound1 digitalmars.com> writes:
Jason House wrote:
 I'll be happy if you simply list casting to shared and immutable when
 listing what isn't allowed in safe functions (and not just casting it
 away.

You're right.
Nov 05 2009