| Deutsch English Français Italiano |
|
<86v81nc3d4.fsf@linuxsc.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Tim Rentsch <tr.17687@z991.linuxsc.com> Newsgroups: comp.lang.c Subject: Re: tcc - first impression. Was: Baby X is bor nagain Date: Tue, 02 Jul 2024 06:47:35 -0700 Organization: A noiseless patient Spider Lines: 52 Message-ID: <86v81nc3d4.fsf@linuxsc.com> References: <v494f9$von8$1@dont-email.me> <v54se1$3bqsk$1@dont-email.me> <20240624160941.0000646a@yahoo.com> <v5bu5r$va3a$1@dont-email.me> <20240624181006.00003b94@yahoo.com> <v5c86d$11ac7$1@dont-email.me> <JEheO.108086$ED9b.74955@fx11.iad> <v5cblg$11q0j$1@dont-email.me> <gEieO.108089$ED9b.25598@fx11.iad> <20240625113616.000075e0@yahoo.com> <mUzeO.141609$Cqra.55051@fx10.iad> <v5elql$1jmii$1@dont-email.me> <m3BeO.24907$Gurd.16179@fx34.iad> <v5empd$1jndv$2@dont-email.me> <v5eph4$1k6a9$1@dont-email.me> <87ed8jnbmf.fsf@bsb.me.uk> <v5jhls$2m7np$1@dont-email.me> <867ceadtih.fsf@linuxsc.com> <20240701200924.00003d9a@yahoo.com> <87zfr0wzpt.fsf@nosuchdomain.example.com> <20240702115448.00002025@yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Date: Tue, 02 Jul 2024 15:47:38 +0200 (CEST) Injection-Info: dont-email.me; posting-host="a921cf177a5ef0d729c498a18e4544b7"; logging-data="1759734"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19R13Nq8MP80FnF29PH6SzK4ZzZQ/7K6Xc=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:jnZE/Wd47Y3u8yP/E+QVGd1E+mg= sha1:EGrJjYpda25x0XqOBkCUTAaxHbA= Bytes: 3880 Michael S <already5chosen@yahoo.com> writes: > On Mon, 01 Jul 2024 14:48:30 -0700 > Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote: > >> Michael S <already5chosen@yahoo.com> writes: >> [...] >>> 4.2. Code like below does not compile. I don't know whether it is >>> legal 'C' or not, >>> but gcc, clang and MSVC compilers accept it o.k. >>> label:int bar; >> >> That's a syntax error in versions of C up to and including C17. C23 >> allows labels on declarations. [...] > > Now I paid attention that my statement above is incorrect: clang does > *not* accept it. > gcc accepts it, for all supported standards, but with -Wpedantic > it issues the warning for all standards except c2x. > MSVC (17 and 19, but not 13) accepts it and issues no warning even with > maximal warning level. > > clang and tcc are right. I find no advantages in this sort of rightness. Is your objection to a diagnostic message being issued, or is your objection to the construct causing the compilation to fail? I would call what the more recent MSVC versions do as being *wrong*. The C standard requires a diagnostic. I would not call what clang and tcc do as being right. Their behavior conforms to the C standard, but giving an unavoidable error is kind of obnoxious. The reported behavior for gcc -pedantic is okay. It would be nice if there were a separate option to allow the non-standard labels to be accepted without giving a warning. Also it would be better if -std=cNN implied -pedantic (presumably with a way to change that, selectively if possible); historically that choice might have been okay, but for at least the last 15 years it has been a disservice to the C community. I should note specifically that it is -pedantic that should be implied, and not -pedantic-error. More generally, the default behavior for any non-conforming but often used construct should be a warning, not an error (unless of course -Werror has been specified). I understand the motivation to give an error in the case of a syntax violation, but forcing any syntax violation to be an error is still a poor choice, not just for the compiler but also for the C community generally. Just my opinions, in case that needs saying.