This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Macro __FUNCTION__ in C++
- To: rysio at rumcajs dot chemie dot uni-halle dot de (Ryszard Kabatek)
- Subject: Re: Macro __FUNCTION__ in C++
- From: Tim Hollebeek <tim at wagner dot princeton dot edu>
- Date: Sun, 13 Sep 1998 06:19:22 -0400 (EDT)
- Cc: egcs at cygnus dot com
Ryszard Kabatek writes ...
>
> The macro __FUNCTION__, or in C9X draft the identifier __func__,
> returns the name of the current function without
> the namespace and without the argument types.
>
> It's good for the C language, but in C++ would be useful something like:
>
> namespace A {
> class B {
> public:
> void calc(int x, double y) const {cout << __FUNCTION__ << '\n'; /**/}
> };
> }
>
> '::A::B::calc(int, double) const' instead of 'calc'
Do you know about __PRETTY_FUNCTION__ ?
g++ 2.7.2 prints "void B::calc(int, double) const' for this example; I don't
know if the latest egcs will put the namespace in front of that or not.
---------------------------------------------------------------------------
Tim Hollebeek | "Everything above is a true
email: tim@wfn-shop.princeton.edu | statement, for sufficiently
URL: http://wfn-shop.princeton.edu/~tim | false values of true."