Path: ...!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: Mon, 17 Jun 2024 18:46:59 +0200 Organization: A noiseless patient Spider Lines: 35 Message-ID: References: <666ded36$0$958$882e4bbb@reader.netnews.com> <87ed8x4zjl.fsf@nosuchdomain.example.com> <666f10b7$0$1412896$882e4bbb@reader.netnews.com> <20240617003207.452@kylheku.com> <66703f13$0$7062$882e4bbb@reader.netnews.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Mon, 17 Jun 2024 18:46:59 +0200 (CEST) Injection-Info: dont-email.me; posting-host="6eee6dfb82180fb756db1a7758fc4b5a"; logging-data="791036"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18eqLGXRkPfmBQALziOwbaEJxqS0p8vKxk=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Cancel-Lock: sha1:nLTzm98MllMmK6yQJBQ5ggyD2zE= In-Reply-To: Content-Language: en-GB Bytes: 2482 On 17/06/2024 17:23, Richard Harnden wrote: > On 17/06/2024 14:50, DFS wrote: >> On 6/17/2024 3:39 AM, Kaz Kylheku wrote: >> >>> I think DFS might mean that they find themselves >> >> he finds himself >> >> >>> unable to omit the unnecessary return 0 statement entirely. >> >> yes >> >> > > If a function is defined to return an int, then you should return one. > > Anything else is just lazy/sloppy.  Just because main allows it as a > special case doesn't mean it's a good idea. > > I mean: it's really not much extra to type. There's nothing wrong with ending your "main" with "return 0;". What Keith said was that it is unnecessary, that using parenthesis in the form "return(0);" looks like like a function call and is considered poor style by many people, and that it is useful to know that when "main" exists without an explicit returned value, it does so as though it had exited with "return 0;". (And in another branch, he said the return type for "main" on hosted C systems should be "int".) These are all true statements. If you prefer to end "main" with "return 0;", that's absolutely fine - but it is /not/ lazy or sloppy to omit it.