From 5712948326829475569
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,83aac58a7c7d6c46
X-Google-Attributes: gidf78e5,public
From: comeau@panix.com (Greg Comeau)
Subject: Re: Advice: C9X's __func__ on C++
Date: 1999/06/09
Message-ID: <7jm1mu$d1v$1@panix.com>#1/1
X-Deja-AN: 487574603
Approved: Fergus Henderson <fjh@cs.mu.oz.au>
References: <slrn7lra47.6l.bcombee@bcombee.metrowerks.com>
X-Original-Date: 9 Jun 1999 11:37:02 -0400
X-Complaints-To: news@news.unimelb.edu.au
X-Trace: izvestia.its.unimelb.edu.au 928950299 10963 128.250.29.16 (9 Jun 1999 17:44:59 GMT)
Organization: Comeau Computing; http://www.comeaucomputing.com
X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUAN16n/+EDnX0m9pzZAQEM9wF+J1tD5mGGRordBbQK7yiBbsADAPwsx6dF PcCD/ijP7wRI7Rd+dLX0MpfzMMLSyUk8 =uW8h
Reply-To: comeau@comeaucomputing.com
NNTP-Posting-Date: 9 Jun 1999 17:44:59 GMT
Newsgroups: comp.std.c++
X-Newsposter: trn 4.0-test55 (26 Feb 97)

In article <slrn7lra47.6l.bcombee@bcombee.metrowerks.com> bcombee@metrowerks.com (Ben Combee) writes:
>The drafts of C9X (soon to be C0X, it seems) define a predefined
>identifier called __func__ that is visible in any function as a
>static array of char holding the name of the function.
>
>I want advice on what the contents of this should be for our C++
>compiler.  C9X defines the name to be the simple name of the function,
>so for a function called foo, it would be "foo".  With overloading
>and namespaces, just using "foo" seems insufficient for the C++ version
>of this, but on the other hand, using a namespace-complete form with
>expanded argument list seems like overkill.
>
>Any advice?  What would be most useful for the programmers?  Also,
>note that C9X's assert() macro requires the use of __func__ in its
>output.

It can't be overkill because with anything less it would not be possible
to produce a unique name.  For instance, a strong use of it would be
in debugging, instrumentation, etc.

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.

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.
That is to say, it could start eating up a chunk of memory in some programs.
Such "machinery" seems to have been a bold move for them.

Surely C++ throws a few curves here too.

- Greg
-- 
       Comeau Computing, 91-34 120th Street, Richmond Hill, NY, 11418-3214
     Producers of Comeau C/C++ 4.2.38 -- New Release!  We now do Windows too.
    Email: comeau@comeaucomputing.com / Voice:718-945-0009 / Fax:718-441-2310
                *** WEB: http://www.comeaucomputing.com *** 
---
[ 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              ]



