A summary of D's design principles

Walter Bright newshound2 at digitalmars.com
Sun Sep 19 16:31:40 PDT 2010


JMRyan wrote:
> 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.

Good points.


More information about the Digitalmars-d mailing list