Macro __FUNCTION__ in C++

Joseph H. Buehler jhpb@sarto.gaithersburg.md.us
Fri Sep 18 02:04:00 GMT 1998


Ryszard Kabatek <rysio@rumcajs.chemie.uni-halle.de> 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'

FYI, here is what the AIX 4.2 C++ compiler returns for __FUNCTION__:

main(int,char**)

Joe Buehler



More information about the Gcc mailing list