Deutsch English Français Italiano |
<87pls883zz.fsf@fatphil.org> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Phil Carmody <pc+usenet@asdf.org> Newsgroups: comp.lang.c Subject: Re: Whaddaya think? Date: Sun, 23 Jun 2024 11:20:16 +0300 Organization: A noiseless patient Spider Lines: 31 Message-ID: <87pls883zz.fsf@fatphil.org> References: <666ded36$0$958$882e4bbb@reader.netnews.com> <87ed8x4zjl.fsf@nosuchdomain.example.com> <666f10b7$0$1412896$882e4bbb@reader.netnews.com> <v4o7om$er18$1@dont-email.me> <20240617003207.452@kylheku.com> <66703f13$0$7062$882e4bbb@reader.netnews.com> <v4pkea$n98h$2@dont-email.me> <20240622151026.607@kylheku.com> MIME-Version: 1.0 Content-Type: text/plain Injection-Date: Sun, 23 Jun 2024 10:36:05 +0200 (CEST) Injection-Info: dont-email.me; posting-host="2f92f1bfc64c9f0dc064462cdd11a123"; logging-data="289393"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19NFlHCs8b2X9YpAIP/f94j" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) Cancel-Lock: sha1:y/sYcwRUD8TxsMTI9zH39giBKh0= sha1:sdyC2M9Dqelk/5duaq6TUqR1pVo= Bytes: 2560 Kaz Kylheku <643-408-1753@kylheku.com> writes: > On 2024-06-17, Richard Harnden <richard.nospam@gmail.invalid> wrote: >> 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. > > The misfeature of missing return being success was, I believe, not > intended to make programs shorter. It was intendeda to correct the > random termination statuses of countless numbers of programs in a single > stroke. > > Deliberately relying on this in a new program is like relying ona a > diaper. If you're of intermediate age, you don't do this. Astronauts do this quite frequently. Some pilots too. And divers. And crane operators. It's a well-established solution to a known problem. However, I'd still put the explicit return in for a reason of literal portability: were I to want to lift that code out into a separate function called by main(), I'd want it to behave the same. Phil -- We are no longer hunters and nomads. No longer awed and frightened, as we have gained some understanding of the world in which we live. As such, we can cast aside childish remnants from the dawn of our civilization. -- NotSanguine on SoylentNews, after Eugen Weber in /The Western Tradition/