Deutsch English Français Italiano |
<v4oo8k$hpno$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!3.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Janis Papanagnou <janis_papanagnou+ng@hotmail.com> Newsgroups: comp.lang.c Subject: Re: Whaddaya think? Date: Mon, 17 Jun 2024 09:22:58 +0200 Organization: A noiseless patient Spider Lines: 50 Message-ID: <v4oo8k$hpno$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> <v4okl2$flpo$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 09:23:00 +0200 (CEST) Injection-Info: dont-email.me; posting-host="ce947dcd9ea98bb3504b70234e0c429c"; logging-data="583416"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/XkdkYnqB9tGRFEn9cg/pE" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 Cancel-Lock: sha1:yOTVZv1kcK2jsV5274u702HyP2M= X-Enigmail-Draft-Status: N1110 In-Reply-To: <v4okl2$flpo$1@dont-email.me> Bytes: 3977 On 17.06.2024 08:21, James Kuyper wrote: > 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. > Re portability: Of course there's other requirements for portable and generally for professional code. I wrote a lot more professional code in C++ than in C but the same requirements hold. Defining the version of the standard, the supported platforms, activation of high warning levels - we wanted our code free of warnings! -, and whatnot. Janis