Deutsch   English   Français   Italiano  
<20240630191018.00007961@yahoo.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: Michael S <already5chosen@yahoo.com>
Newsgroups: comp.lang.c
Subject: Re: Baby X is bor nagain
Date: Sun, 30 Jun 2024 19:10:18 +0300
Organization: A noiseless patient Spider
Lines: 64
Message-ID: <20240630191018.00007961@yahoo.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>
	<v5jm32$2nqvp$1@dont-email.me>
	<v5k3v2$2qllm$1@dont-email.me>
	<v5kfst$2svt3$1@dont-email.me>
	<v5kmlm$2u918$1@dont-email.me>
	<20240627201830.854@kylheku.com>
	<v5m2nl$39qob$3@dont-email.me>
	<20240628032211.403@kylheku.com>
	<v5p4rv$3u92q$1@dont-email.me>
	<v5phah$168u$1@dont-email.me>
	<v5posa$2kq0$1@dont-email.me>
	<20240630121835.00000e48@yahoo.com>
	<v5rv37$j79k$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 30 Jun 2024 18:09:57 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="878897f5e23d7e00958d040114fc15f1";
	logging-data="617251"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+mZuyz1QMsC14Kmp5xS0AgWiHY1rqR5s4="
Cancel-Lock: sha1:As2wtHBYo+vz0CeBn5dzIult8mQ=
X-Newsreader: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-w64-mingw32)
Bytes: 4485

On Sun, 30 Jun 2024 17:54:14 +0200
David Brown <david.brown@hesbynett.no> wrote:

> On 30/06/2024 11:18, Michael S wrote:
> > On Sat, 29 Jun 2024 20:55:54 +0100
> > bart <bc@freeuk.com> wrote:
> >   
> >> On 29/06/2024 18:46, Richard Harnden wrote:  
> >>> On 29/06/2024 15:14, bart wrote:
> >>> [...]  
> >>>> My older bcc compiler reported 4 as a hard error unless an
> >>>> override was used.  
> >>>
> >>> But you didn't say anything about main's args.  
> >>
> >> I did, indirectly. The actual error was the use of "()" as an empty
> >> parameter list (for any function, not just main, but my example
> >> could also have been 'void H(){H(123);}'). If you tried to compile:
> >>
> >>      int main() {
> >>          main(123);
> >>      }
> >>
> >> then it wouldn't get past the () to the call.
> >>
> >> Eventually I dropped that restriction, and the reason was that so
> >> much code used such parameter lists, for any function.
> >>
> >> Not because they wanted unchecked args (there are some legitimate
> >> use-cases within function pointer types), but because so many
> >> people assumed () meant zero parameters like (void).
> >>
> >> Why was such code so common? Presumably because compilers said
> >> nothing; and they couldn't because the language allowed it. If they
> >> had required an override like mine did, more would have got the
> >> message.
> >>  
> > 
> > I tried following code:
> > int foo() { return 1; }
> > 
> > Both MSVC and clang warn about it at high warnings level (-Wall for
> > MSVC, -Wpedantic for clang). But they dont warn at levels that most
> > people use in practice (-W3 or -W4 for MSVC, -Wall for clang).
> > gcc13 produces no warning even at -Wpedantic. It does produce
> > warning with '-Wpedantic -std=xxx' for all values of xxx except c23
> > and gnu23. The absence of warning for c23/gnu23 makes sense, the
> > rest of gcc behavior - less so.
> >   
> 
> gcc -Wpedantic makes very little sense without specifying a C
> standard (rather than a gnu C standard).
> 
> But why would you expect a warning from code that is perfectly legal
> and well-defined C code, without explicitly enabling warnings that
> check for particular style issues?  Non-prototype function
> declarations are deprecated (since C99), but not removed from the
> language until C23 (where that declaration is now a function
> prototype).

I expect warning at -Wall, because it is deprecated. Those who do
not want warning can turn it off explicitly with -Wno-strict-prototypes
or whatever the name of the switch.