Deutsch English Français Italiano |
<v4okl2$flpo$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!2.eu.feeder.erje.net!feeder.erje.net!news.swapon.de!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: James Kuyper <jameskuyper@alumni.caltech.edu> Newsgroups: comp.lang.c Subject: Re: Whaddaya think? Date: Mon, 17 Jun 2024 02:21:22 -0400 Organization: A noiseless patient Spider Lines: 40 Message-ID: <v4okl2$flpo$1@dont-email.me> References: <666ded36$0$958$882e4bbb@reader.netnews.com> <20240616015649.000051a0@yahoo.com> <v4lm16$3s87h$4@dont-email.me> <v4lmso$3sl7n$1@dont-email.me> <v4lr0m$3tbpj$1@dont-email.me> <8734pd4g3s.fsf@nosuchdomain.example.com> <v4ltuj$3trj2$1@dont-email.me> <87y17530a0.fsf@nosuchdomain.example.com> <v4mb92$3ak$1@dont-email.me> <87tths39yy.fsf@nosuchdomain.example.com> <v4oi9f$gnf3$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Injection-Date: Mon, 17 Jun 2024 08:21:23 +0200 (CEST) Injection-Info: dont-email.me; posting-host="a7b132bb65603ea19d45fd3964c95a9e"; logging-data="513848"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18tv1CyU/Xry3oNwCLM6EFqMJKM6vQvfOY=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:fa4uc/BYXvLcDHDN07VWEP47zTg= In-Reply-To: <v4oi9f$gnf3$1@dont-email.me> Content-Language: en-US Bytes: 3437 On 6/17/24 01:41, Janis Papanagnou wrote: > On 16.06.2024 22:32, Keith Thompson wrote: >> Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes: >>> [...] K&R at >>> least seems to say that 'void' can only be declared for the >>> return type of functions that do not return anything. >>> [...] >> >> No version of C has ever permitted "void main" except when an >> implementation documents and permits it. [...] > > I cannot comment on main() being handled differently than > other C functions. I was just quoting my old copy of K&R. It is handled differently. Your own functions can be declared in a wide variety of ways, so long as the declaration that is relevant to function designator in a function call is compatible with the definition of the function that it designates. C standard library functions can only be declared in ways compatible with the specifications in the C standard. main(), on the other hand, is unique, in that you have two incompatible choices of how to define it, and an implementation can designate additional choices. You can define main() in any way compatible with one of the options supported by your implementation; but portable code should define it only in one of the two ways specified by the C standard. K&R is long obsolete; up-to-date drafts of the standard that are almost identical to the latest version of the standard are free and easily available. > I don't understand what you mean with "no version of C has > ever permitted", given that my C compiler doesn't complain. He wrote "No version of C has ever permitted "void main" except when an implementation documents and permits it." Note that he is talking about versions of the standard, not versions of any particular implementation of C. If your C compiler "documents and permits" "void main", then it certainly shouldn't complain about it. However, since the C standard does not mandate support for void main, you've no guarantee of portability of code that uses void main to other implementations of C.