null [re: spec#]

Walter Bright newshound2 at digitalmars.com
Sun Nov 7 23:01:38 PST 2010


Nick Sabalausky wrote:
> Well I'll be damned, even C/C++ knows that uninitialized variables shouldn't 
> be used, and yet D doesn't. This is where Walter claims that getting rid of 
> that warning improves safety because it prevents people from "shutting the 
> compiler up" by changing this:
> 
> int i = i + 5;
> 
> Into this code which D happily accepts:
> 
> int i;
> i = i + 5;


For the code:

   void test()
   {
     int i = i + 5;
   }

D reports:

   test.d(4): Error: undefined identifier i


More information about the Digitalmars-d mailing list