From -4048719841161517673
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,83aac58a7c7d6c46
X-Google-Attributes: gidf78e5,public
From: James Kuyper <kuyper@wizard.net>
Subject: Re: Advice: C9X's __func__ on C++
Date: 1999/06/10
Message-ID: <375F0EC6.7C0238C7@wizard.net>#1/1
X-Deja-AN: 487729281
X-NNTP-Posting-Host: 209.8.153.16
Content-Transfer-Encoding: 7bit
Approved: stephen.clamage@sun.com (comp.std.c++)
References: <slrn7lra47.6l.bcombee@bcombee.metrowerks.com> <7jm1mu$d1v$1@panix.com>
To: comp-std-c++@moderators.uu.net
X-UID: 0000000001
X-Status: $$$T
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: newsabuse@remarQ.com
X-Trace: 928976203.301.16 BM4DTI4VW9910D108C qube-01.us-va.remarq.com
Organization: Not Enough
Mime-Version: 1.0
NNTP-Posting-Date: Thu, 10 Jun 1999 00:56:43 GMT
Newsgroups: comp.std.c++
Originator: clamage@taumet


Greg Comeau wrote:
....
> Then again, I think that the C proposal has limitations in C too
> (this is not to put it down, I don't know how much more it could do).
> For instance, as I recall it, two static functions in different
> translation units would have the same name.

                    ^^^^^ could

> As well, I know this gets queasyish, but I'm surprised there was no
> wording to the effect that whether it is available or not is unspecified.

It's meant to be guaranteed, not implementation-defined.

> That is to say, it could start eating up a chunk of memory in some programs.

Since __func__ is local to the function, the memory is needed only if
something in the function itself actually refers to __func__, something
which can easily be checked at compile time. This follows from the as-if
rule, but there's also a relevant as-if in the definition of __func__
itself:

"The identifier _ _func_ _ shall be implicitly declared by the
translator as if, immediately following the opening brace of each
function definition, the declaration

	static const char __func__[]="_function-name_";

appeared, where _function-name_ is the name of the lexically-enclosing
function."


[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]




