null [re: spec#]
Nick Sabalausky
a at a.a
Sun Nov 7 22:22:48 PST 2010
"Jussi Jumppanen" <jussij at zeuseedit.com> wrote in message
news:ib84l5$205p$1 at digitalmars.com...
> so Wrote:
>
>> Not related to this but i have to share.
>> Try compiling this in C/C++.
>>
>> int i = i + 5; // something like this.
>
> void main()
> {
> int i = i + 5; // something like this.
> }
>
> Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for
> 80x86
> Copyright (C) Microsoft Corporation. All rights reserved.
>
> test.c
> c:\temp\test.c(3) : warning C4700: uninitialized local variable 'i' used
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;
More information about the Digitalmars-d
mailing list