Macro __FUNCTION__ in C++

Ryszard Kabatek rysio@rumcajs.chemie.uni-halle.de
Sun Sep 13 02:00:00 GMT 1998


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'


Ryszard Kabatek

Martin-Luther University Halle-Wittenberg
Department of Physical Chemistry
Geusaer Str. 88, 06217 Merseburg, Germany
Tel. +49 3461 46 2487 Fax. +49 3461 46 2129
e-mail: kabatek@chemie.uni-halle.de




More information about the Gcc mailing list