Wishlist: const char * __CLASS__ within member definitions

Giuliano Procida myxie@debian.org
Fri Oct 1 09:18:00 GMT 1999

Dear gcc developers,

The implicit string __FUNCTION__ is very nice, but too limited for C++
given the use overloading and virtual functions. I never use
__PRETTY_FUNCTION__ as the extra type information often dwarfs the
function name by a line length when using templated types.

Is there any chance of __CLASS__? Or should that be __NAMESPACE__?
The code in gcc for __FUNCTION__ looks simple enough to adapt if you
know where to find the enclosing class name.


struct foo {
  ~foo ()
    { DBPRINT ("%s %p dtor", __CLASS__, this); }
  size_t bar (string h) {
     DBPRINT ("%s::%s", __CLASS__, __FUNCTION__);
     return h.size();
  static const char * NAME = __CLASS__;

More information about the Gcc-bugs mailing list