Summary: Unused last assignment warning
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: diagnostic
          Severity: enhancement
          Priority: P2
         Component: DMD

--- Comment #0 from 2010-08-20 14:44:40 PDT ---
This enhancement request is about a warning that helps avoid some kinds of

(This is related but distinct from the enhancement request of bug 3960
This has nothing to do with uninitialized variables, it's kind of the opposite

The "Unused last assignment warning" means that you assign something to a
variable, and then you do nothing with it.

The compiler is often able to remove the dead code, but the presence of this
situation may denote low quality code, or code where the programmer has
forgotten to use the variable. In both cases it's useful to find such

void main() {
    int x;
    x = 10; // warning here

Here 'x' is not an unused variable, because the code does something with it, so
there is no warning for unused variable (bug 3960 ), but this code deserves a
warning anyway because the last value assigned to x is not unused.

It is better to not show this warning if the variable address is assigned to a
pointer or similar things.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to