Deutsch English Français Italiano |
<v4r4qg$16pi5$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!feed.opticnetworks.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: Tue, 18 Jun 2024 07:09:34 +0200 Organization: A noiseless patient Spider Lines: 53 Message-ID: <v4r4qg$16pi5$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> <877ceo2iqq.fsf@nosuchdomain.example.com> <v4onrg$hmc2$1@dont-email.me> <v4pe9e$lpi6$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Injection-Date: Tue, 18 Jun 2024 07:09:37 +0200 (CEST) Injection-Info: dont-email.me; posting-host="2cfb9c8e8c0845d0115863010bdaf45c"; logging-data="1271365"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18TsMcFqzZA2cSBB2tp7oYi" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 Cancel-Lock: sha1:kYX9HTVGl/U4BcLq2fe9GFsOD88= In-Reply-To: <v4pe9e$lpi6$1@dont-email.me> X-Enigmail-Draft-Status: N1110 Bytes: 3566 On 17.06.2024 15:38, James Kuyper wrote: > On 6/17/24 03:16, Janis Papanagnou wrote: >> On 17.06.2024 08:20, Keith Thompson wrote: >>> Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes: >>>> If I want a defined exit status (which is what I usually >>>> want) I specify 'int main (...)' and provide an explicit >>>> return statement (or exit() call). >>> >>> Why would you ever not want a defined exit status, given that it's >>> easier to have one than not to have one? >> >> Aren't we agreeing here? (The only difference is that you are >> formulating in a negated form where I positively said the same.) > > You implied, by saying "If I want a defined exit status", that there are > occasions where you don't want a defined exit status ....where I don't _need_ one. Yes. E.g. in code like main() { printf("hello, world\n"); } > - and he's > questioning that. Things that are undefined are seldom useful. I disagree. If things are undefined it _may_ just not matter. If things matter they should not (ideally never) be undefined. > If the > exit status is undefined, it might be a failure status. In many > contexts, that would cause no problems, but there's also places where it > would. Exactly. > > ... >> Well, to indicate that there's no status information or that >> it's irrelevant. E.g. as was the case in the test fragment I >> posted. > > That's the problem - your "indication that there's no status > information" doesn't achieve the desired effect. Instead, it results in > an unspecified status being returned to the system. If might be a > successful status, or an unsuccessful status. On the systems I use, > scripts that execute programs will often abort if the program returns an > unsuccessful status code. If there's nothing that needs to be brought to > the system's attention, use "return 0;", not "void main()". In cases where the return status is a substantial part of the external specification, yes. Return status is not self purpose! YMMV. Janis