Path: csiph.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: gcc and 'include' Date: Mon, 30 Mar 2026 11:54:37 -0700 Organization: None to speak of Lines: 50 Message-ID: <87v7edtafm.fsf@example.invalid> References: <10q4ceb$38i2d$1@dont-email.me> <87ikaiw5g0.fsf@example.invalid> <10q5nnr$3l3lc$1@dont-email.me> <10q6snp$2nka$5@dont-email.me> <10q6uv4$419b$1@dont-email.me> <20260328203718.00005c70@yahoo.com> <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> MIME-Version: 1.0 Content-Type: text/plain Injection-Date: Mon, 30 Mar 2026 18:54:38 +0000 (UTC) Injection-Info: dont-email.me; posting-host="af1e4d03e5d4687ab81b254102748b94"; logging-data="2850913"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19ZY9BNi7zMnCDYnNGeuk9V" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:/ua7tw/yseFGPBNeM0u9cF1uQDo= sha1:IsJ040ecUrmFH3BZF+gaJmeSaFg= Xref: csiph.com comp.lang.c:397313 Bart 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 */