🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #3754

Re: __FUNC__ vs __FUNCTION__

#3754
From: Clive D.W. Feather
Date: Wed, 16 Aug 1995 23:07
42 lines
2399 bytes
In article <40t7k0$3r4@light.twinsun.com>,
Paul Eggert <eggert@twinsun.com> wrote:
>dmm@neutron.torolab.ibm.com (Dave Mooney) writes:
>> string literals 
>> get pasted in phase 6, but the implementation doesn't know what function it
>> is translating until phase 7.
> And I don't see any problem with phase 6.  String literal pasting can't
> possibly change the answer to the question ``what function am I
> currently translating?''.  So if the implementation can ``know'' which
> function it is translating in phase 7, it can also ``know'' it in phase 6.
> Of course, the notion ``the implementation doesn't know what function
> it is translating'' is not formally defined in the standard.

"What function am I currently translating" is related to the syntax
defined in clause 6 of the standard. The compiler can't know it *is*
translating a function until the parser has converted to source to a
parse tree (or equivalent operation), and can then attach function names
to each sub-tree corresponding to a function.

None of this happens until TP7. But string pasting takes place in TP6.

> Since __FUNCTION__ is the most
> useful design,

This is begging the question. I wouldn't say that __FUNCTION__ is better
than preprocessing, for example, and I'd hate to see TP4 fiddled with as
a result.

However,

> if the phases-of-translation model prohibits it then we
> should fix the phases-of-translation model.

Some parts of the phases-of-translation model are easy to fix. And, from
a brief look at the situation, TP6 is totally redundant: it can be
replaced by a small piece of syntax, plus moving the semantics into TP7.
So making __FUNCTION__ a string might be worthwhile after all.

-- 
Clive D.W. Feather                       | If you lie to the compiler,
clive@demon.net        (work, preferred) | it will get its revenge.
clive@stdc.demon.co.uk (home)            |   - Henry Spencer
Technical Details
Message-ID: <DDFEx1.M93@stdc.demon.co.uk>
Path: arc1-ca.pugleaf.net!stdc.demon.co.uk!clive
References: <3udssr$32j@info1.sdrc.com> <HBF.95Aug1194442@durin.uio.no> <40t0k3$pom@tornews.torolab.ibm.com> <40t7k0$3r4@light.twinsun.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!stdc.demon.co.uk!clive
From: clive@stdc.demon.co.uk (Clive D.W. Feather)
Newsgroups: comp.std.c
Subject: Re: __FUNC__ vs __FUNCTION__
Date: Wed, 16 Aug 1995 23:07:47 GMT
Organization: Demon Internet Limited (personal account)
Message-ID: <DDFEx1.M93@stdc.demon.co.uk>
References: <3udssr$32j@info1.sdrc.com> <HBF.95Aug1194442@durin.uio.no> <40t0k3$pom@tornews.torolab.ibm.com> <40t7k0$3r4@light.twinsun.com>
X-NNTP-Posting-Host: stdc.demon.co.uk