Google Mail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion __FUNCTION__ ????

View Parsed - Show only message text

Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!paloalto-snf1.gtei.net!news.gtei.net!enews.sgi.com!newsfeeds.funet.fi!newsfeed1.funet.fi!ousrvr3.oulu.fi!not-for-mail
From: Kalle Olavi Niemitalo <k...@iki.fi>
Newsgroups: comp.lang.c
Subject: Re: __FUNCTION__ ????
Date: 19 Oct 2001 15:12:38 +0300
Organization: University of Oulu, Department of Electrical Engineering, Finland
Lines: 26
Sender: t...@stekt34.oulu.fi
Message-ID: <iznofn3rfpl.fsf@stekt34.oulu.fi>
References: <47295485.0110190255.7f389085@posting.google.com>
NNTP-Posting-Host: stekt34.oulu.fi
X-Trace: ousrvr3.oulu.fi 1003493560 11734 130.231.60.74 (19 Oct 2001 12:12:40 GMT)
X-Complaints-To: news@news.oulu.fi
NNTP-Posting-Date: 19 Oct 2001 12:12:40 GMT
X-URL: http://www.iki.fi/kon/
X-Newsreader: Gnus v5.7/Emacs 20.6

sob...@eudoramail.com (Sobhan Vezzu) writes:

>          I understood that __FUNCTION__ is a preprocessor macro, which
> will substitute a file name. Similar to __FILE__ and __LINE__.

__FUNCTION__ is a GCC-specific extension.  Please read the node
"Function Names" in the GCC Info file or "Function Names as Strings"
in the printed manual; it's all explained there.

>          1) I have written a small code, only for __FUNCTION__ it
> prints as unknown why?

__FUNCTION__ is not a preprocessor macro, because the preprocessor
does not know about functions.

C99 has a similar identifier __func__, which isn't a preprocessor
macro either.

>          2) Where do I get a list of all the preprocessor macros.

If you're using GCC on Unix, you can do this:

  gcc -E -dM -xc /dev/null

i.e., preprocess an empty file as C and list all defined macros when
finished.  Many of those macros are not in any standard.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google