Boost logo

Threads-Devel :

From: Jeroen van der Wulp (J.v.d.Wulp_at_[hidden])
Date: 2007-10-24 06:45:38


Lars Gullik Bjønnes wrote:
> Jeroen van der Wulp <J.v.d.Wulp_at_[hidden]> writes:
>
> | Hello,
> |
> | When building in release mode a lot of warnings about unused variables
> | come along. In debug mode there is an assert statement so the variable
> | is used, but in release mode it is not.
>
> Why assert on variables that are not in use?
>

Not quite, what I meant is that the assert is the only use of the
variable. So when compiling in release mode there will be no code for
the asserts, so the variable is no longer used. For example:

boost/thread/pthread/mutex.hpp:
         ~mutex()
         {
             int const res=pthread_mutex_destroy(&m);
             BOOST_ASSERT(!res);
         }

-Jeroen


Threads-Devel list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk