Re: Casting the return value of ...

Liste des GroupesRevenir à cl c 
Sujet : Re: Casting the return value of ...
De : 433-929-6894 (at) *nospam* kylheku.com (Kaz Kylheku)
Groupes : comp.lang.c
Date : 28. Mar 2024, 23:44:28
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20240328142950.542@kylheku.com>
References : 1 2 3 4 5
User-Agent : slrn/pre1.0.4-9 (Linux)
On 2024-03-28, Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
The warnings I get from gcc are:
>
warning: ISO C forbids conversion of function pointer to object pointer type [-Wpedantic]
warning: ISO C forbids conversion of object pointer to function pointer type [-Wpedantic]
>
With -pedantic-errors, these become fatal errors.
>
I disagree with gcc.  ISO C doesn't define the behavior, but it doesn't
forbid the conversion.

It's never good for a diagnostic to be stating a blatant falsehood,
regardless of whether the presence of the diagnostic is a good idea
or not.

There is a problem in the man page also (haven't checked the main  doc):

    Issue all the warnings demanded by strict ISO C and ISO C++;
    reject all programs that use forbidden extensions, and some
    other programs that do not follow ISO C and ISO C++.  For ISO C,
    follows the version of the ISO C standard specified by any -std
    option used.

There are no "forbidden extensions"! There are extensions we have,
and extensions we don't have. Extensions we don't have a undefined
behavior.

The misconception is repeated in the GNU Conding Conventions. It might
have come from the same person.

https://www.gnu.org/prep/standards/standards.html

    But we do not follow either of these specifications rigidly, and
    there are specific points on which we decided not to follow them, so
    as to make the GNU system better for users.

    For instance, Standard C says that nearly all extensions to C are
    prohibited. How silly! GCC implements many extensions, some of which
    were later adopted as part of the standard. If you want these
    constructs to give an error message as “required” by the standard,
    you must specify ‘--pedantic’, which was implemented only so that we
    can say “GCC is a 100% implementation of the standard”, not because
    there is any reason to actually use it.

Standard C does not say that any extensions are prohibited.
How silly to think so, and write about it, and code a facet of the
compiler diagnostic system that way!

I'm actually opening a GCC bugzilla about this right now.

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

Date Sujet#  Auteur
28 Mar 24 * Casting the return value of ...31Kenny McCormack
28 Mar 24 +* Re: Casting the return value of ...27Kaz Kylheku
28 Mar 24 i+* Re: Casting the return value of ...20Keith Thompson
28 Mar 24 ii`* Re: Casting the return value of ...19bart
28 Mar 24 ii +* Re: Casting the return value of ...12Keith Thompson
28 Mar 24 ii i+- Re: Casting the return value of ...1Chris M. Thomasson
28 Mar 24 ii i+* Re: Casting the return value of ...8Kaz Kylheku
29 Mar 24 ii ii+* Re: Casting the return value of ...5Kaz Kylheku
29 Mar 24 ii iii`* Re: Casting the return value of ...4Kaz Kylheku
29 Mar 24 ii iii `* Re: Casting the return value of ...3Michael S
29 Mar 24 ii iii  `* gcc Bugzilla search (was: Casting the return value of ...)2Michael S
29 Mar 24 ii iii   `- Re: gcc Bugzilla search1David Brown
29 Mar 24 ii ii+- Re: Casting the return value of ...1Keith Thompson
8 Jun 24 ii ii`- Re: Casting the return value of ...1Tim Rentsch
29 Mar 24 ii i`* Re: Casting the return value of ...2David Brown
30 Mar 24 ii i `- Re: Casting the return value of ...1Chris M. Thomasson
29 Mar 24 ii `* Re: Casting the return value of ...6David Brown
29 Mar 24 ii  `* Re: Casting the return value of ...5bart
29 Mar 24 ii   +- Re: Casting the return value of ...1David Brown
30 Mar 24 ii   `* Re: Casting the return value of ...3Tim Rentsch
30 Mar 24 ii    `* Re: Casting the return value of ...2bart
9 Apr 24 ii     `- Re: Casting the return value of ...1Tim Rentsch
30 Mar 24 i`* Re: Casting the return value of ...6Tim Rentsch
31 Mar 24 i +* Re: Casting the return value of ...3Lawrence D'Oliveiro
31 Mar 24 i i+- Re: Casting the return value of ...1David Brown
31 Mar 24 i i`- Re: Casting the return value of ...1Chris M. Thomasson
9 Apr 24 i `* Re: Casting the return value of ...2Tim Rentsch
9 Apr 24 i  `- Re: Casting the return value of ...1David Brown
29 Mar 24 +* Re: Casting the return value of ...2Andrey Tarasevich
29 Mar 24 i`- Re: Casting the return value of ...1Keith Thompson
30 Mar 24 `- Re: Casting the return value of ...1Tim Rentsch

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal