🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #3601

Re: __FUNC__ vs __FUNCTION__

#3601
From: Hallvard B Furuseth
Date: Tue, 01 Aug 1995 17:44
22 lines
1460 bytes
In article <1995Jul25.180413.3420@news.wrc.xerox.com> leisner@sdsp.mc.xerox.com (Marty Leisner 25733) writes:
> I lobbied for __FUNC__ for years...Aztec C had a __FUNC__ which
> was incredibly useful...

BTW, I compared gcc's __FUNCTION__ with the __func proposal at the ISO C
site (ftp://ftp.dmk.com/DMK/sc22wg14/c9x/func/func.txt.gz), and I'd
suggest to copy __FUNCTION__ instead of that from the proposal.

* __FUNCTION__ is actually a string, so we can use string concatenation:
	void foo () { puts ( "Called " __FUNCTION__ "()."); }
  and so it also ends up in read-only memory, like real strings, despite
  its non-const* type.  While the __func proposal suggests
	static char __func[] = "name";
  to get correct type and correct sizeof(__func).

* __FUNCTION__ is defined outside functions (as ""), so macros can
  safely use it without worrying about how and where they are called.

-- 
Regards,

Hallvard
Technical Details
Message-ID: <HBF.95Aug1194442@durin.uio.no>
Path: arc1-ca.pugleaf.net!nntp.uio.no!usenet
References: <3udssr$32j@info1.sdrc.com> <3ujagg$h0q@light.twinsun.com> <3uu5an$ohi@info1.sdrc.com> <1995Jul25.180413.3420@news.wrc.xerox.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!nntp.uio.no!usenet
From: h.b.furuseth@usit.uio.no (Hallvard B Furuseth)
Newsgroups: comp.std.c
Subject: Re: __FUNC__ vs __FUNCTION__
Date: 1 Aug 1995 17:44:42 GMT
Organization: University of Oslo, Norway
Message-ID: <HBF.95Aug1194442@durin.uio.no>
References: <3udssr$32j@info1.sdrc.com> <3ujagg$h0q@light.twinsun.com>
 <3uu5an$ohi@info1.sdrc.com> <1995Jul25.180413.3420@news.wrc.xerox.com>
NNTP-Posting-Host: durin.uio.no
In-reply-to: leisner@sdsp.mc.xerox.com's message of Tue, 25 Jul 1995 18:04:13 GMT