Macro __FUNCTION__ in C++

Ryszard Kabatek
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 {
    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

More information about the Gcc mailing list