On Mon, 28 Sep 2009 16:01:10 -0400, Steven Schveighoffer wrote: > On Mon, 28 Sep 2009 15:35:07 -0400, Jesse Phillips > <[email protected]> wrote: > >> language_fan Wrote: >> >>> Have you ever used functional languages? When you develop in Haskell >>> or SML, how often you feel there is a good change something will be >>> initialized to the wrong value? Can you show some statistics that show >>> how unsafe this practice is? >> >> So isn't that the question? Does/can "default" (by human or machine) >> initialization create an incorrect state? If it does, do we continue to >> work as if nothing was wrong or crash? I don't know how often the >> initialization would be incorrect, but I don't think Walter is >> concerned with it's frequency, but that it is possible. > > It creates an invalid, non-compiling program.
No it doesn't, I'm not referring to null as the invalid state. float a; In this program it is invalid for 'a' to equal zero. If the compiler complains it is not initialized the programmer could fulfill the requirements. float a = 0; Hopefully the programmer knows that it shouldn't be 0, but a correction like this is still possible, the compiler won't complain and the program won't crash. Depending on what 'a' is controlling this could be very bad. I'm really not arguing either way, I'm trying to make it clear since no one seems to be getting Walters positions. BTW, what is it with people writing SomeObject foo; If they believe the compiler should enforce explicit initialization? If you think an object should always be initialized at declaration don't write a statement that only declares and don't set a reference to null.
