$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Beman Dawes (bdawes_at_[hidden])
Date: 2002-08-14 10:59:46
At 11:36 AM 8/14/2002, Douglas Paul Gregor wrote:
 >On Wed, 14 Aug 2002, William E. Kempf wrote:
 >> > > *  !!(predicate) fix as discussed
 >> >
 >> > No longer necessary. I switched to BOOST_TEST(p? true: false); adding 
 >!!
 >> in
 >> > BOOST_TEST would silently test operator!, not the "boolean context"
 >> > conversion.
 >>
 >> I'd say it would still be necessary since other people are sure to use
 >the
 >> same construct.  However, you bring up a good point about it causing 
the
 >> wrong thing to be tested, so !! is the wrong solution.  Probably need 
to
 >> apply the ternary operator instead.
 >
 >Maybe we can introduce another macro here, such as
 >BOOST_TEST_BOOLEAN_CONTEXT, so that what we are checking is more 
explicit?
 >I'm getting big by this same issue in Function, and x? true : false is,
 >IMHO, quite unclear
Ouch!  I hate to see that kind of alternative behavior based on a macro.
For years I've avoided implicit conversions to bool, which usually means 
adding "== 0" or "!= 0", but sometimes "? ... : ..."
I started doing that originally to avoid compiler warnings, but over time 
came to view the resulting code as clearer and more explicit when viewed by 
a maintenance programmer.  It did take some getting used to, however, but 
now feels totally natural.
--Beman