Path: ...!feed.opticnetworks.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: David Brown Newsgroups: comp.lang.c Subject: Re: Whaddaya think? Date: Wed, 19 Jun 2024 09:50:45 +0200 Organization: A noiseless patient Spider Lines: 24 Message-ID: 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; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Wed, 19 Jun 2024 09:50:45 +0200 (CEST) Injection-Info: dont-email.me; posting-host="496e798c2f4d7717891a7779c6d418c6"; logging-data="1962671"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX199LI9y/hPl6Ao2NyRnChU/lM/MhAt/FMs=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Cancel-Lock: sha1:myh9GO16ixkEEl9TqmxWr8OgzpE= In-Reply-To: <87plsdy9aj.fsf@nosuchdomain.example.com> Content-Language: en-GB Bytes: 2791 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.