26 Jul
2007
26 Jul
'07
7:52 p.m.
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