__FUNCTION__ work?
Hi all,
Can anyone tell me if __FUNCTION__ works for the 32-bit tool chain?
I'm quite certain it's not working for the 64-bit toolchain. Alan (Modra), can you fix that?
The output I get from:
printk(__FUNCTION__ "() starts\n");
is
() starts
It's not a disaster, just slightly annoying when debug code doesn't tell me everything I expect. And I know this worked before in the 32-bit toolchain (and probably still does).
thanks,
grant
Quoted 2 lines · Grant Grundler
The output I get from:
printk(__FUNCTION__ "() starts\n");
RTFM. __FUNCTION__ and __func__ are identifiers, not string literals.
Signature · 3 lines
---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------
Quoted 6 lines · Ulrich Drepper
Quoted 2 lines · Grant Grundler
The output I get from:
printk(__FUNCTION__ "() starts\n");RTFM.
__FUNCTION__and__func__are identifiers, not string literals.
Ok. I'll update my usage. tnx.
I tried to find the manual (still looking) but found some other interesting links instead:
http://gcc.gnu.org/ml/gcc-patches/1999-10n/msg00281.html
Jason Merrill <jason at cygnus dot com> wrote:
| In g++, __FUNCTION__ is a variable, not a string literal. | That change was necessary to support templates.
http://agnes.dida.physik.uni-essen.de/~janjaap/mingw32/gcc-announce.html
(gcc 2.8.0 release notes dated Wed, 14 Jan 98 05:59:05 EST)
Richard Kenner wrote:
| __FUNCTION__ and __PRETTY_FUNCTION__ are now treated as variables by | the parser; previously they were treated as string constants. So code | like printf (__FUNCTION__ ": foo")' must be rewritten to printf | ("%s: foo", __FUNCTION__)'. This is necessary for templates.
I've been writing 'C' code since about 1985...old habits die hard. :^)
thanks,
grant
Quoted 4 lines
Signature · 3 lines
---------------. ,-. 1325 Chesapeake Terrace Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA Red Hat `--' drepper at redhat.com `------------------------
Grant Grundler
Unix Systems Enablement Lab
+1.408.447.7253