Boost logo

Boost Users :

From: Boris Gubenko (Boris.Gubenko_at_[hidden])
Date: 2007-07-25 08:51:55


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

----- Original Message -----
From: "Pavel Syomin" <syomin_at_[hidden]>
To: <boost-users_at_[hidden]>
Sent: Wednesday, July 25, 2007 2:01 AM
Subject: Re: [Boost-users] Useful macro

> Hi all!
> New variant of BOOST_ENFORCE macro:
>
> #define BOOST_ENFORCE(expression) \
> do { \
> if(!(expression)) throw std::invalid_argument( \
> __FILE__ " : " BOOST_STRINGIZE(__LINE__) " : " \
> + std::string(BOOST_CURRENT_FUNCTION) + \
> " : Expression '" #expression "' failed"); \
> } while(false)
>
> And few question about it:
> 1. How to escape converting BOOST_CURRENT_FUNCTION to std::string? Is
> there way to get function name as string literal?
> 2. Is line number useful information? I think, that filename and
> function name is good enough.
> 3. Any observations and suggestions?
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>


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