On Oct 17, 9:11 am, "Neal E. Coombes" <neal.coom...@gmail.com> wrote:
> It's cute. I like most of it. It wouldn't likely meet our
> performance requirements but is dead simple. The only thing I would
> change is the PSTADE_IF_DEBUG and PSTADE_UNPARENTHESIZE which are
> completely unnecessary. At least the unparenthesize one is. You
> could define PSTADE_IF_DEBUG as 'if(true)' and 'if(false)' and then
> require the user uses {} instead of (), or you could just have the
> user type 'if(PSTADE_DEBUG)' themselves.
An if-statememnt introduces a scope.
Anyway I tend to prefer #if to IF_DEBUG these days.
> Either way just about every
> compiler I know of will completely remove the if when the conditional
> is a constant literal.
Thanks for the good news. I didn't know certainly that. :-)
I will update my debugging macros, which will be something like:
DEBUG_EXPR(std::cout) << 1 << 2 << 3;
DEBUG_BLOCK { std::cout << 1 << 2 << 3; }
Regards,
--
Shunsuke Sogame
--
[ See
http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]