On 8/10/2012 9:55 PM, F i L wrote:
On the first condition, without an 'else z = ...', or if the condition was
removed at a later time, then you'll get a compiler error and be forced to
explicitly assign 'z' somewhere above using it. So C# and D work in "similar"
ways in this respect except that C# catches these issues at compile-time,
whereas in D you need to:

   1. run the program
   2. get bad result
   3. hunt down bug

However, and I've seen this happen, people will satisfy the compiler complaint by initializing the variable to any old value (usually 0), because that value will never get used. Later, after other things change in the code, that value suddenly gets used, even though it may be an incorrect value for the use.

Reply via email to