A summary of D's design principles
JMRyan
nospam at nospam.com
Sun Sep 19 13:56:26 PDT 2010
One thing that seems to have been missed in this discussion: minimize (or
at least reduce from C++ levels) undefined behavior. That's the reason for
auto-initialized variables. It's not to provide aconvenience for those
times when the default values are what you want. It's so that failure to
initialize will cause your program to fail in consistent and predictable
ways. It is also the reason for providng clear() as an alternative to
delete(). Dereferencing dangling pointers results in undefined behavior.
Accessing a cleared object results in admittedly bad but at least defined
behavior.
More information about the Digitalmars-d
mailing list