Groups | Search | Server Info | Login | Register


Groups > comp.lang.c > #397313

Re: gcc and 'include'

From Keith Thompson <Keith.S.Thompson+u@gmail.com>
Newsgroups comp.lang.c
Subject Re: gcc and 'include'
Date 2026-03-30 11:54 -0700
Organization None to speak of
Message-ID <87v7edtafm.fsf@example.invalid> (permalink)
References (6 earlier) <10q96uf$rjbn$1@dont-email.me> <10q9t6d$2p36t$1@paganini.bofh.team> <10qc632$1uds9$1@dont-email.me> <86mrzp1oql.fsf@linuxsc.com> <10qdujq$2g7uj$1@dont-email.me>

Show all headers | View raw


Bart <bc@freeuk.com> writes:
[...]
> The rules may well be precise, but they can also allow for laxity in
> how code is written, and how strictly they are enforced by a compiler.
>
> That is why exactly the same program can pass with 0 warnings or
> errors, pass with some warnings, or fail with errors, depending on the
> options provided. So:
>
>   c:\cx>gcc mcc.c
>
>   c:\cx>gcc -Wall -Wextra -Wpedantic -O2 mcc.c 2>errors
>
> The first invocation compiled fine. The second generated thousands of
> warnings, for the same language standard. With -Werror, it would also
> fail.
  
Not the same language.  gcc with no "-std=..." option compiles the
GNU C dialect.  The default is "-std=gnuNN", where NN is 17 or 23
for recent versions of gcc.  That's reasonable if your code depends
on GNU extensions, but not if you want to make a point about the
C language as defined by the ISO standard(s).

If you care about the C language as defined by the ISO standard,
you should be using something like "-std=cNN -pedantic" (or
"-pedantic-errors"), where NN is the relevant edition of the
standard.

With "-Wall -Wextra", if you get "thousands of warnings", it's
because you asked for them.

You're complaining about gcc being lax, not about the C language
being lax.

Of course you know all this.

I think there is some laxity in ISO C's treatment of "inline",
some cases where one conforming implementation might successfully
handle a program and another might reject it.  I agree that's not
ideal.  But as a programmer, you can avoid it by understanding the
standard's rules for "inline" and writing portable code.  (And as
an implementer, you can either make a choice within the range of
options allowed by the standard, or you can make a non-conforming
implementation that does whatever you prefer.)

[...]

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */

Back to comp.lang.c | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

gcc and 'include' Bart <bc@freeuk.com> - 2026-03-26 22:36 +0000
  Re: gcc and 'include' Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-03-26 16:12 -0700
    Re: gcc and 'include' Bart <bc@freeuk.com> - 2026-03-27 10:55 +0000
      Re: gcc and 'include' David Brown <david.brown@hesbynett.no> - 2026-03-27 13:49 +0100
      Re: gcc and 'include' Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-03-27 10:51 -0700
      Re: gcc and 'include' Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-03-27 21:27 +0000
        Re: gcc and 'include' Bart <bc@freeuk.com> - 2026-03-27 22:05 +0000
          Re: gcc and 'include' Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-03-27 17:03 -0700
          Re: gcc and 'include' Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2026-03-28 05:10 +0100
          Re: gcc and 'include' Michael S <already5chosen@yahoo.com> - 2026-03-28 20:37 +0300
            Re: gcc and 'include' Bart <bc@freeuk.com> - 2026-03-28 18:33 +0000
              Re: gcc and 'include' antispam@fricas.org (Waldek Hebisch) - 2026-03-29 00:53 +0000
                Re: gcc and 'include' Bart <bc@freeuk.com> - 2026-03-29 22:37 +0100
                Re: gcc and 'include' Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-30 05:33 -0700
                Re: gcc and 'include' Bart <bc@freeuk.com> - 2026-03-30 14:42 +0100
                Re: gcc and 'include' Michael S <already5chosen@yahoo.com> - 2026-03-30 16:53 +0300
                Re: gcc and 'include' Bart <bc@freeuk.com> - 2026-03-30 18:11 +0100
                Re: gcc and 'include' Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-30 08:27 -0700
                Re: gcc and 'include' Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-03-30 11:54 -0700
                Re: gcc and 'include' Bart <bc@freeuk.com> - 2026-03-30 21:54 +0100
                Re: gcc and 'include' Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-03-30 18:07 -0700
                Re: gcc and 'include' Bart <bc@freeuk.com> - 2026-03-31 11:39 +0100
                Re: gcc and 'include' Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-03-31 13:56 -0700
                Re: gcc and 'include' Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-04-06 20:56 -0700
                Re: gcc and 'include' Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-04-06 23:12 -0700
                Re: gcc and 'include' James Kuyper <jameskuyper@alumni.caltech.edu> - 2026-03-30 21:06 -0400
              Re: gcc and 'include' David Brown <david.brown@hesbynett.no> - 2026-03-29 11:24 +0200
                Re: gcc and 'include' Bart <bc@freeuk.com> - 2026-03-29 12:44 +0100
                Re: gcc and 'include' David Brown <david.brown@hesbynett.no> - 2026-03-31 15:57 +0200
            Re: gcc and 'include' Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-30 07:20 -0700
          Re: gcc and 'include' Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-30 05:07 -0700
  Re: gcc and 'include' Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-03-27 00:25 +0000
    Re: gcc and 'include' Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-03-30 07:13 +0000
      Re: gcc and 'include' Andrey Tarasevich <noone@noone.net> - 2026-03-30 07:54 -0700
        Re: gcc and 'include' Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-03-31 01:46 +0000
          Re: gcc and 'include' antispam@fricas.org (Waldek Hebisch) - 2026-03-31 05:28 +0000
  Re: gcc and 'include' Michael S <already5chosen@yahoo.com> - 2026-03-27 04:10 +0300
    Re: gcc and 'include' Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-26 19:08 -0700
      Re: gcc and 'include' Michael S <already5chosen@yahoo.com> - 2026-03-27 16:47 +0300
        Re: gcc and 'include' David Brown <david.brown@hesbynett.no> - 2026-03-27 16:43 +0100
        Re: gcc and 'include' Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-27 09:03 -0700
          Re: gcc and 'include' Michael S <already5chosen@yahoo.com> - 2026-03-29 11:46 +0300
            Re: gcc and 'include' Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-30 08:19 -0700
              Re: gcc and 'include' Michael S <already5chosen@yahoo.com> - 2026-03-30 20:08 +0300
                Re: gcc and 'include' Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-31 00:26 -0700
                Re: gcc and 'include' Michael S <already5chosen@yahoo.com> - 2026-03-31 11:27 +0300
                Re: gcc and 'include' Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-04-07 09:45 -0700
        Re: gcc and 'include' Andrey Tarasevich <noone@noone.net> - 2026-03-28 10:25 -0700
          Re: gcc and 'include' Michael S <already5chosen@yahoo.com> - 2026-03-29 10:37 +0300
            Re: gcc and 'include' David Brown <david.brown@hesbynett.no> - 2026-03-29 11:30 +0200
            Re: gcc and 'include' Andrey Tarasevich <noone@noone.net> - 2026-03-29 07:22 -0700
            Re: gcc and 'include' James Kuyper <jameskuyper@alumni.caltech.edu> - 2026-03-29 13:56 -0400
              Re: gcc and 'include' Michael S <already5chosen@yahoo.com> - 2026-03-29 21:39 +0300
                Re: gcc and 'include' James Kuyper <jameskuyper@alumni.caltech.edu> - 2026-03-29 20:08 -0400
                Re: gcc and 'include' Bart <bc@freeuk.com> - 2026-03-30 01:58 +0100
                Re: gcc and 'include' Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-30 07:59 -0700
  Re: gcc and 'include' Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-26 19:06 -0700
  Re: gcc and 'include' Bart <bc@freeuk.com> - 2026-03-27 16:20 +0000
    Re: gcc and 'include' David Brown <david.brown@hesbynett.no> - 2026-03-27 18:07 +0100
    Re: gcc and 'include' James Kuyper <jameskuyper@alumni.caltech.edu> - 2026-03-28 18:48 -0400
  Re: gcc and 'include' Andrey Tarasevich <noone@noone.net> - 2026-03-27 22:38 -0700
    Re: gcc and 'include' Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-28 00:30 -0700
      Re: gcc and 'include' Andrey Tarasevich <noone@noone.net> - 2026-03-29 16:15 -0700
        Re: gcc and 'include' Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-03-30 00:41 -0700

csiph-web