Wish: Variable Not Used Warning
Markus Koskimies
markus at reaaliaika.net
Fri Jul 11 12:05:41 PDT 2008
On Thu, 10 Jul 2008 16:06:45 -0400, superdan wrote:
> byte a, b;
> byte c = a + b;
I think that compilers should never generate warnings in these cases. If
you overflow in arithmetic operations of same types, it is at most
runtime error issue. You should know how large values can be stored in
basic types, and use large enough data type in the code.
Since explicit casting easily hides bugs, it should not be used
overwhelmingly.
> 5. warning - statement is not reachable
>
> this is a tad more messy. people routinely insert a premature return in
> there to check for stuff. it pisses me off when that won't compile.
That is very good example, why it would be good to have possibility to
(temporarily) generate code even when it has warnings. That way the
warning does not go anywhere and you still can debug your program.
> i discovered i could do this:
>
> if (true) return crap;
Thanks! :)
More information about the Digitalmars-d
mailing list