Boost logo

Boost :

From: Gennadiy Rozental (gennadiy.rozental_at_[hidden])
Date: 2007-04-11 11:28:05


"Thorsten Ottosen" <thorsten.ottosen_at_[hidden]> wrote in message
news:461CF01A.4010209_at_dezide.com...
> Hi Gennadiy,
>
> When I use macros such as
>
> BOOST_CHECK_MESSAGE( !evidence,
> "update evidence = " <<
> withEvidenceUpdate << ", evidence = " << *evidence );
>
> it annoys me that the second argument is evaluated even when the test
> should pass.
>
> In the case above, evidence is an optional<int>. It would be cool if the
> construction of the error messsage could be delayed until it was
> actually needed, to make the above scenario valid.
>
> Do you think that is possible?

The problem is that I might need the message even if test passes(to print
confirmation massages, if log level is set to "all").

Why exactly does it bother you?

You could always workaround it with your own macro:

#define MY_CHECK_MSG( expr, MSG ) \
if( (expr) ) \
{} \
else \
    BOOST_CHECK_MSG( false, MSG ) \
/**/

Gennadiy


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk