null [re: spec#]

Walter Bright newshound2 at digitalmars.com
Mon Nov 8 23:06:12 PST 2010


Nick Sabalausky wrote:
> "Walter Bright" <newshound2 at digitalmars.com> wrote in message 
>> 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.

I see no reason why people would do that. It doesn't save typing, it isn't 
convenient, etc.


More information about the Digitalmars-d mailing list