"Walter Bright" <newshou...@digitalmars.com> wrote in message news:ib87ai$26u...@digitalmars.com... > 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
Yes, which by your "people will toss something in to shut the compiler up" reasoning will then cause people to turn that into this "to shut the compiler up": void test() { int i; i = i + 5; } Which the D compiler will be perfectly happy with even though it's probably wrong.