Safety, undefined behavior, @safe, @trusted
Walter Bright
newshound1 at digitalmars.com
Thu Nov 5 12:18:11 PST 2009
Steven Schveighoffer wrote:
> Sounds
> good to me. Should you also be able to mark a whole struct/class as
> @safe/@trusted, since it's generally a container for member functions?
Yes.
> Care to define some rules for "undefined behavior?"
I suppose I need to come up with a formal definition for it, but it's
essentially meaning your program is going to do something arbitrary
that's outside of the specification of the language. Basically, you're
stepping outside of the domain of the language.
For example, assigning a random value to a pointer and then trying to
read it is undefined behavior. Casting const away and then modifying the
value is undefined behavior.
More information about the Digitalmars-d
mailing list