D Best Practices: Default initializers for structs

Simen kjaeraas simen.kjaras at gmail.com
Sun Nov 7 05:50:37 PST 2010


d'oh <homer at simpsons.name> wrote:

> Arguable floating points would do better with -Infinity

Why? A signaling nan tells you 'you'trying to use an uninitialized value!'.


> and integral types with a negative value e.g. -1, -2 or as negative as  
> possible.

Why? I can see some reasons, like foo * -1 yields a negative answer, while
foo * 0 yields 0, which is a fairly common value. Still what are your
reasons for saying it's the best?


> I suspect booleans would do better with true (this being the furtherest
> away from false .. that if is false is taken to be the origin of the
> boolean value axis).

And if true is taken to be the origin, then false would be the best?


-- 
Simen


More information about the Digitalmars-d mailing list