On Friday 22 July 2011 15:40:00 Trass3r wrote:
> Am 21.07.2011, 21:55 Uhr, schrieb Andrej Mitrovic
> 
> <[email protected]>:
> > On 7/21/11, Jacob Carlborg <[email protected]> wrote:
> >> How about you create a new type, that can be implicitly converted to
> >> float and is initialized to 0.0.
> > 
> > Ha, never thought about that! When I think about it, most of the time
> > I want my floats to be 0-initialized.
> 
> me too!

Well, the idea with default initializers is that they're as close as possible 
to an invalid value (hence NaN for floats) so that it becomes apparent faster 
if you screwed up and didn't initialize them before using them. So, that's why 
floats aren't 0 by default. Integral values wouldn't be 0 either if the 
integral types had something akin to NaN.

- Jonathan M Davis

Reply via email to