From mboxrd@z Thu Jan 1 00:00:00 1970 From: Martin Ambuhl To: help-gcc@gnu.org Subject: Re: how to declare dynamic 2-dimensional array in C++? Date: Sat, 01 Apr 2000 00:00:00 -0000 Message-ID: <3870E536.5A00FA79@earthlink.net> References: <386da233.0@news.tm.net.my> <84n59m$daj$1@nnrp1.deja.com> <386fac89@eeyore.callnetuk.com> <84pbp4$j4t$1@nnrp1.deja.com> <84pus001rnr@enews2.newsguy.com> X-SW-Source: 2000-q1/msg00024.html Message-ID: <20000401000000.-KkCu_Wl8mUb41eLQaKje45-4x3xTnjB2CXOqwh9bOs@z> "Johnny Favorite (it means \"Writhing Tentacle of Death\")" wrote: > > Alex Vinokur wrote: > > 3. __PRETTY_FUNCTION__ > > --FUNCTION__ > > Since your other two examples were pretty cool-sounding I have to ask about > this one. What the heck does __PRETTY_FUNCTION__ do? File: gcc.info, Node: Function Names, Next: Return Address, Prev: Incomplete Enums, Up: C Extensions Function Names as Strings ========================= GNU CC predefines two string variables to be the name of the current function. The variable `__FUNCTION__' is the name of the function as it appears in the source. The variable `__PRETTY_FUNCTION__' is the name of the function pretty printed in a language specific fashion. These names are always the same in a C function, but in a C++ function they may be different. For example, this program: extern "C" { extern int printf (char *, ...); } class a { public: sub (int i) { printf ("__FUNCTION__ = %s\n", __FUNCTION__); printf ("__PRETTY_FUNCTION__ = %s\n", __PRETTY_FUNCTION__); } }; int main (void) { a ax; ax.sub (0); return 0; } gives this output: __FUNCTION__ = sub __PRETTY_FUNCTION__ = int a::sub (int) These names are not macros: they are predefined string variables. For example, `#ifdef __FUNCTION__' does not have any special meaning inside a function, since the preprocessor does not do anything special with the identifier `__FUNCTION__'. -- Martin Ambuhl mambuhl@earthlink.net What one knows is, in youth, of little moment; they know enough who know how to learn. - Henry Adams A thick skin is a gift from God. - Konrad Adenauer __________________________________________________________ Fight spam now! Get your free anti-spam service: http://www.brightmail.com