tobold.org

correct • elegant • free

△ comp.unix.shell △

◅ exit code

exit code ▻

exit code

In article <387C9A85.CD5D1289@Unforgetable.com>,
Kenneth C Stahl  <BlueSax@Unforgetable.com> wrote:
>I disagree. 'break' and 'continue' are not a violation of structured
>programming and provide a means of simplifying code.

And using exit() doesn't simplify code?  Here's an example from some
code I look after.  (Can anyone spot its relevance to this group? :-)

    extern void *ealloc(size_t n) {
            void *p = malloc(n);

            if (p == NULL) {
                    uerror("malloc");
                    rc_exit(1);
            }
            return p;
    }

The function ealloc() is called from 44 different places in the program.
So far as the caller is concerned, ealloc() always succeeds (if not, it
doesn't return).  Adding all the code so that each of those 44 calls
checked for allocation errors, and could bubble the error all the way
back up to main() would probably double the size of the program.

Tim.
--
Tim Goodwin   | "If you don't know what closures are, you probably don't
Leicester, UK | want to know what closures are." -- Larry Wall

Original headers:

From: tjg@star.le.ac.uk (Tim Goodwin)
Newsgroups: comp.unix.shell
Subject: Re: exit code
Date: 13 Jan 2000 12:02:17 -0000
Message-ID: <85kesv$6uu$1@ltpcg.star.le.ac.uk>
References: <387bcf87.8748165@news.demon.co.uk>
  <387C7BF1.FCA43676@Unforgetable.com> <85i4rt$497$1@ltpcg.star.le.ac.uk>
  <387C9A85.CD5D1289@Unforgetable.com>

△ comp.unix.shell △

◅ exit code

exit code ▻