[Issue 3960] Unused variable warning

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Aug 20 09:04:32 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=3960



--- Comment #2 from bearophile_hugs at eml.cc 2010-08-20 09:04:27 PDT ---
There is more than just unused variables, there are also unused last
assignments:


void main() {
    int x;
    x = 10;
}


Here 'x' is not an unused variable, because the code does something with it,
but the code deserves a warning anyway (and one C compiler-like shows this
warning) because the last value assigned to it gets unused; and this is wasted
coding/running effort at best, or sign of a possible latent bug (just like
unused variables).

This warning isn't necessary if the variable address is assigned to a pointer
or similar things.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list