On Saturday, 14 April 2012 at 05:19:38 UTC, dennis luehring wrote:
Am 14.04.2012 06:00, schrieb F i L:
struct Foo {
int x, y; // ready for use.
float z, w; // messes things up.
float r = 0; // almost always...
}
how often in your code is 0 or 0.0 the real starting point?
i can't think of any situation except counters or something
where 0 is a proper start - and float 0.0 is in very very few
cases a normal start - so whats your point?
Every place that a structure property is designed to be mutated
externally. Almost all Math structures, for instance.
Defaults are to combat garbage values, but debugging cases where
values where accidentally unset (most likely missed during
construction) seems like a better job for a unittest.