Path: ...!feed.opticnetworks.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Whaddaya think? Date: Wed, 19 Jun 2024 13:13:19 -0700 Organization: None to speak of Lines: 47 Message-ID: <87cyocy9ls.fsf@nosuchdomain.example.com> References: <666ded36$0$958$882e4bbb@reader.netnews.com> <20240616015649.000051a0@yahoo.com> <8734pd4g3s.fsf@nosuchdomain.example.com> <87y17530a0.fsf@nosuchdomain.example.com> <87tths39yy.fsf@nosuchdomain.example.com> <877ceo2iqq.fsf@nosuchdomain.example.com> <87plsf17q1.fsf@nosuchdomain.example.com> <87plsdy9aj.fsf@nosuchdomain.example.com> MIME-Version: 1.0 Content-Type: text/plain Injection-Date: Wed, 19 Jun 2024 22:13:24 +0200 (CEST) Injection-Info: dont-email.me; posting-host="14c46e9d4441e9b6d7e573ea203ad727"; logging-data="2258878"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX191F7/wWzVsettYoBAo15dC" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) Cancel-Lock: sha1:yqvhfOYEHs+Yw0qXcmULx3PqnUM= sha1:mUxI2BBNVMD4Gn6Fmt5YdKXX9tQ= Bytes: 3567 David Brown writes: > On 19/06/2024 04:07, Keith Thompson wrote: >> Keith Thompson writes: >> [...] >>> That's fine. A return statement or exit() call is unnecessary >>> in main() due to a special-case rule that was added in 1999 for >>> compatibility with C++. I don't particularly like that rule myself. >>> I choose to omit the return statement in small programs, but if >>> you want to add the "return 0;", I have absolutely no objection. >>> (I used to do that myself.) It even makes your code more portable >>> to old compilers that support C90. (tcc claims to support C99, >>> but it has a bug in this area.) >> A minor point: The latest unreleased version of tcc appears to fix >> this bug. In tcc 0.9.27, falling off the end of main (defined as >> "int main(void)") returns some random status. In the latest version, >> it returns 0, based on a quick experiment and a cursory examination >> of the generated object code. (tcc doesn't have an option to >> generate an assembly listing; I used "tcc -c" followed by "objdump >> -d".) >> > > Godbolt has support for tcc, which might be convenient if you want to > look at its output. > > If anyone cares, I found the git commit where this was fixed: commit 3b9c3fd1860ceaa5684d5837455084707a7848c9 Author: Michael Matz Date: 2018-11-03 22:17:20 +0100 Fix noreturn in main() ISO C requires 'main' falling through the end without explicit returns to implicitely return 0 (if declared as returning int). The most recent release of tcc is 0.9.27, released 2017-12-17. But the git repo (, mirror at has updates as recently as 2024-03-22. Post-0.9.27 updates are on the "mob" branch. Godbolt's "TCC (trunk)" is built from the latest version in git. -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com void Void(void) { Void(); } /* The recursive call of the void */