Deutsch   English   Français   Italiano  
<20250316115725.530@kylheku.com>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: Kaz Kylheku <643-408-1753@kylheku.com>
Newsgroups: comp.lang.c
Subject: Re: __func__ is not a keyword
Date: Sun, 16 Mar 2025 19:05:05 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 36
Message-ID: <20250316115725.530@kylheku.com>
References: <vr4lgu$63fu$1@dont-email.me>
 <87bju2htxy.fsf@nosuchdomain.example.com>
 <6sCBP.1140938$t84d.713135@fx11.iad>
 <87bju0x10g.fsf@nosuchdomain.example.com>
Injection-Date: Sun, 16 Mar 2025 20:05:06 +0100 (CET)
Injection-Info: dont-email.me; posting-host="9304094fac7608a7c5a324c0f9e098b2";
	logging-data="2477897"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/T4d6YrarwsBtPXmv/XWD509IHYMqTtWU="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:OzlU0W3vofmiu3Yrlmwzn3NZy0s=
Bytes: 2367

On 2025-03-16, Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
> source code and its behavior indicate that gcc treats __func__ as
> a keyword, which is inconsistent with the info page.  For example,
> one would expect this:
>
> int main(void) {
>     {
>         int __func__;
>     }
> }
>
> to be accepted, with the inner definition of __func__ hiding the
> implicit static declaration, but gcc reports a syntax error.
>
> It's not a conformance issue, since __func__ is a reserved identifier
> and any code that can tell whether it's a keyword has undefined
> behavior.

But __func__ is not a reserved identifier! Inside a function, it's a
documented identifier with specified properties, and those properties do
not support an interpretation that it may be a keyword.

We have to distinguish between specific, defined, standard identifiers
allocated from a reserved namespace, and the reserved namespace itself.

If gcc (in c99 mode or later) *allowed*  int _Bool = 42;   would you
call that conforming, because _B* is in the reserved namespace, so
any behavior is okay?

Since __func__ is not described as existing outside of a function,
there, it is just an identifier landing in the reserved namespace.

-- 
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca