On 02/17/2016 09:49 AM, Jonathan Wakely wrote:
https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Attributes.html says
that attribute((warn_unused)) is not useful for std::mutex because it
controls a resource. That's incorrect, std::mutex *is* a resource, but
it doesn't control one. In fact declaring std::mutex as a local
variable and then never using it almost certainly is a mistake,
because it won't be locked unless you use it.

A better example of a type that controls a resource would be
std::lock_guard, which you would typically construct and then never
refer to again (because everything interesting happens in the
constructor and destructor).

OK for trunk?

OK.

Jason


Reply via email to