Re: No warning on unused variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> > Why did this not warn me about the unused stringstream?
[snip]
> it is concievable that declaring this object
 > might be sufficient for some action to be taken by the code, thus
 > rendering it incorrect for -Wall to report it.

You got it in one.  For example, you might see

  {
    lock myLock;
... }

where the lock constructor locks memory and the destructor releases
it.
It might be nice if g++ could add an __attribute__ setting so you could tag a class with something like ctor_has_no_useful_side_effects. Classes with this attribute could then be allowed to raise the "declared but not used" warning. It would be most useful on things like std::string, which you also wouldn't want just laying around.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux