Sujet : Re: __func__ is not a keyword
De : 643-408-1753 (at) *nospam* kylheku.com (Kaz Kylheku)
Groupes : comp.lang.cDate : 16. Mar 2025, 20:05:05
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20250316115725.530@kylheku.com>
References : 1 2 3 4
User-Agent : slrn/pre1.0.4-9 (Linux)
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/txrCygnal: Cygwin Native Application Library: http://kylheku.com/cygnalMastodon: @Kazinator@mstdn.ca