|
Boost Users : |
From: Klaus Backert (Klaus.Backert_at_[hidden])
Date: 2007-07-26 15:52:18
Hi,
Am 25.07.2007 um 14:51 schrieb Boris Gubenko:
> Pavel Syomin wrote:
>> 1. How to escape converting BOOST_CURRENT_FUNCTION to std::string? Is
>> there way to get function name as string literal?
>
> Some compilers support __FUNCTION__ macro.
>
> Thanks,
> Boris
as far as I know, for GNU compilers __func__ is part of the C99
standard. Older versions recognize only __FUNCTION__, but it is not
standardized.
For better portability the following provides a fallback definition
with the preprocessor:
#if __STDC_VERSION__ < 199901L
#if __GNUC__ >= 2
#define __func__ __FUNCTION__
#else
#error "function name variable is not defined"
#endif
#endif
... and in C++ there is PRETTY_FUNCTION, e.g. "void a::foo(int)"
instead of "foo".
Greetings
Klaus
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net