Boost logo

Boost :

From: James Fowler (boost_list_at_[hidden])
Date: 2005-02-19 09:12:13


I don't see anything in <boost/current_function.hpp> which would allow
one to determine at compile time whether or not BOOST_CURRENT_FUNCTION
is able to produce anything useful (instead of "unknown"). The attached
patch adds another define, BOOST_CURRENT_FUNCTION_KNOWN, which will be
true if BOOST_CURRENT_FUNCTION should produce something better than
"unknown", or false otherwise.

The patch is pretty simple. It leverages the existing logic in
<boost/current_function.hpp>, so it should just "work" on any compiler
which didn't already have problems with <boost/current_function.hpp>
before the patch. So far I've tested it with msvc-6.0
(BOOST_CURRENT_FUNCTION_KNOWN=0) and msvc-7.1
(BOOST_CURRENT_FUNCTION_KNOWN=1).

- james

John Eddy wrote:

>
>> I'm using BOOST_CURRENT_FUNCTION; I couldn't tell you quickly which
>> header/library that comes from though.
>>
> You get it in the header <boost/current_function.hpp>. Some compilers
> have macros similar to __LINE__ and __FILE__ for the function
> signature but these macros are not standardized. So
> BOOST_CURRENT_FUNCTION makes use of the non-standard macros where
> possible and resolves to "(unknown)" otherwise.

-- 
__________________________________________________________
 James Fowler, Open Sea Consulting
 http://www.OpenSeaConsulting.com, Marietta, Georgia, USA
 Do C++ Right.  http://www.OpenCpp.org, opening soon!

Index: boost/boost/current_function.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/current_function.hpp,v
retrieving revision 1.10
diff -r1.10 current_function.hpp
53a54
> # define BOOST_CURRENT_FUNCTION_KNOWN 0
56a58,61
> #ifndef BOOST_CURRENT_FUNCTION_KNOWN
> # define BOOST_CURRENT_FUNCTION_KNOWN 1
> #endif
>


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