Re: mutex failing (stupid C++!)

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

 



"Kaz Kylheku" <kaz@xxxxxxxxxxxxxxxxx> writes:
> This should be diagnosed by -Wunused, IMHO. You are calling a
> constructor, but ignoring the return value.
...
> into the program, -Wunused will give you a diagnostic. But if you
> construct an object and ignore the result, you don't get a diagnostic.

Of course constructors (and destructors) can have side-effects, and it's
not that uncommon to create objects just for such side-effects.  I'm not
sure how common it is to use _unnamed_ objects in this way (I've never
done it I think, and it seems ever so slightly dodgy), but obviously it's
possible...

I guess gcc could warn when there are obviously no side-effects but who
knows how easy that is (and maybe the few cases it catches aren't worth
the effort).

-Miles
-- 
"Suppose He doesn't give a shit?  Suppose there is a God but He
just doesn't give a shit?"  [George Carlin]

[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