Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c,comp.lang.c++ Subject: Re: Switching to C# Date: Sun, 16 Jun 2019 02:24:25 -0700 Organization: None to speak of Lines: 32 Message-ID: References: <5d03bb38.3305609877@core> <5d059fdf.3429680737@core> <5d05fa0f.3452768783@core> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="df4904b93ef33b63818a6c0a0a5ba2e4"; logging-data="9381"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18JmA2Z+/vNYDgomaSL1h2O" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:Y3Y9gnDblneLdWRo/JkjuK01d4U= sha1:wqs0E9YcT2KVW6CdXg6B9lo6n94= Xref: csiph.com comp.lang.c:144916 comp.lang.c++:66460 nobody@example.org (Scott) writes: > On Sat, 15 Jun 2019 19:31:13 -0700, Keith Thompson > wrote: >>nobody@example.org (Scott) writes: >>[...] >>> C does allow implicit declarations. You can call a previously >>> undeclared function, and C will trust that the types you're passing >>> are the types the function's expecting. I think it's a bad idea, and >>> it usually yields warnings suggesting that it's a bad idea. I think >>> any form of implicit typing is a bad idea. >> >>No, it doesn't. Calling an undeclared function has been a constraint >>violation since C99 dropped the "implicit int" rule. > > Apparently not a fatal one. gcc 7.4 with -std=c99 warns, but builds it > anyway. As I said, it's a constraint violation. That means that a conforming compiler must issue a diagnostic message. It's not required to be fatal. In fact the only construct that required a fatal error is the "#error" directive. (I personally wish gcc were more strict, but that's a whole 'nother kettle of fish.) The lesson is that warnings from C compilers should be taken *very* seriously. "gcc -std=c99 -pedantic" results in a fatal error. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Will write code for food. void Void(void) { Void(); } /* The recursive call of the void */