During preparation and presentation of a Lightning Talk about my BOOST_WITH
Macro at the C++Now 2015 Conference, three important issues showed need for being addressed:
- The
if
statement solution with an unused (and useless) condition variable leads to compiler warnings. This is a noteworthy fail, since compiler warnings were part of my motivation for developing the macro in the first place! - You could write code like
BOOST_WITH(whatever) {} // if(true) {} else foo();
– which is clearly not desirable.
- An alternative implementation, using a single-pass
for
loop suffers a similar problem – you couldbreak
andcontinue
in aBOOST_WITH
block.
The Macro clearly had to be revisited…