Re: __func__ is not a keyword

Liste des GroupesRevenir à cl c 
Sujet : Re: __func__ is not a keyword
De : tr.17687 (at) *nospam* z991.linuxsc.com (Tim Rentsch)
Groupes : comp.lang.c
Date : 18. Mar 2025, 18:00:31
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <86cyeeqno0.fsf@linuxsc.com>
References : 1 2 3 4
User-Agent : Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:

Kaz Kylheku <643-408-1753@kylheku.com> writes:
>
On 2025-03-15, Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
>
I'm mildly curious how gcc and clang treat "__func__" internally
that leads to this odd behavior.  The obvious way to implement it
would be to internally create a declaration of __func__ on entry
to each function definition, which shouldn't cause the symptom
you're seeing.  But it's not a conformance issue
>
The main reason is this:
>
  "As an extension, at file (or, in C++, namespace scope), __func__
   evaluates to the empty string."
>
But it produces a diagnostic
>
warning: ?__func__? is not defined outside of function scope
>
And in a very quick look through the documentation, I don't see
a way to disable that warning (other than "-w", which disables
all warnings).  Looks like they don't really want you using this
extension.

It seems more likely that they just don't care.  I expect there
has been very little demand for an option specifically to cover
this situation.

By the way, clang has -Wpredefined-identifier-outside-function,
along with the corresponding no- version to turn off the warning.


Date Sujet#  Auteur
15 Mar 25 * __func__ is not a keyword15Thiago Adams
15 Mar 25 `* Re: __func__ is not a keyword14Keith Thompson
15 Mar 25  +* Re: __func__ is not a keyword3Thiago Adams
15 Mar 25  i`* Re: __func__ is not a keyword2Keith Thompson
15 Mar 25  i `- Re: __func__ is not a keyword1Keith Thompson
16 Mar 25  +* Re: __func__ is not a keyword3Kaz Kylheku
16 Mar 25  i`* Re: __func__ is not a keyword2Keith Thompson
18 Mar 25  i `- Re: __func__ is not a keyword1Tim Rentsch
16 Mar 25  `* Re: __func__ is not a keyword7Keith Thompson
16 Mar 25   `* Re: __func__ is not a keyword6Kaz Kylheku
16 Mar 25    +* Re: __func__ is not a keyword4Keith Thompson
17 Mar 25    i`* Re: __func__ is not a keyword3Kaz Kylheku
17 Mar 25    i `* Re: __func__ is not a keyword2Keith Thompson
17 Mar 25    i  `- Re: __func__ is not a keyword1Kaz Kylheku
16 Mar 25    `- Re: __func__ is not a keyword1James Kuyper

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal