What is the stance on partial initializers when declaring multiple variables of the same type?

Andrej Mitrovic andrej.mitrovich at gmail.com
Fri Jul 22 22:16:07 PDT 2011


On 7/22/11, Jonathan M Davis <jmdavisProg at gmx.com> wrote:
> Integral values wouldn't be 0 either if the
> integral types had something akin to NaN.

Maybe if you're coming from C or C++ you're used to having to manually
initialize everything.

I personally don't think the issue is about putting a variable in a
known invalid state, but just about putting it in a known state to
begin with. And you don't get either of those in C and C++.

I think 0 for integrals as a default is a great feature. It is a
*known* feature, and it's pretty much what I want in 99% of my code. I
only ever have to manually specify initializers in very few places for
integrals, which saves me a lot of time.

Remember, D cares about usability as much as it cares about memory
safety. 0 for integrals is a time-saving feature.


More information about the Digitalmars-d mailing list