Boost logo

Boost :

From: Moore, Paul (Paul.Moore_at_[hidden])
Date: 1999-09-01 04:41:14


From: Beman Dawes [mailto:beman_at_[hidden]]
> >> * Reporting of file and line.
> >
> >These are contradicting. We must choose.
>
> Well, it is possible to pass __LINE__ and __FILE__ as arguments, but
> you are right in that people probably wouldn't like to do that extra
> coding.

It's not possible to completely eliminate macros, and still get __LINE__
and __FILE__, but is a reasonable compromise a ASSERTION_INFO(str)
macro, which packages up __LINE__, __FILE__, and str, and passes them on
to the assertion function? Still requires a macro, but limits it to one
optional case (and offers the string argument as an incentive to use
it)...

Usage might be assertion<WHENEVER>(i != 0, ASSERTION_INFO("need some
input"))

Paul.

PS The other way in which a macro has the advantage is in that it can
"stringize" and report the actual expression being asserted.


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