Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Jul 2001 21:14:06 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Warner Losh <imp@harmony.village.org>
Cc:        Wes Peters <wes@softweyr.com>, Assar Westerlund <assar@FreeBSD.org>, Brian Somers <brian@Awfulhak.org>, cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/lib/libutil ecalloc.c emalloc.3 emalloc.c erealloc.c estrdup.c Makefile libutil.h 
Message-ID:  <Pine.BSF.4.21.0107232048460.32891-100000@besplex.bde.org>
In-Reply-To: <200107230624.f6N6Ooo87330@harmony.village.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 23 Jul 2001, Warner Losh wrote:

> In message <001c01c1133a$f2b9ac50$24b244cc@blabber> "Wes Peters" writes:
> : I agree with Alfred, I really don't like the idea of a program exiting 
> : willy-nilly and feel this will encourage developers to do so.  It is 
> : marginally better than not testing return values at all, and hoping 
> : for a core file, but only marginally so.  The fact that it has been 
> : done alot in existing code doesn't make it a good practice, just a
> : common one.
> 
> And they should *NEVER* be used in a library.  Libraries that exit
> instead of returning an error are lame beyond words.  I don't think we
> want to introduce APIs that are safe in cat.c, but unsafe in libc.

Yes, most exit() and err*() calls in libraries are bugs.

Other problems with this idea:
- the new functions don't belong in libutil for various reasons:
  + libutil should not be a home for miscellaneous functions.
  + shared linkage to another library is a pessimization (always in
    time and perhaps in space too).
- these functions are often named xmalloc(), etc. (e.g., in gnu utilities).
  Are you going to changes all these too?  (Certainly not in contrib).

I noticed new copies of these functions growing faster than the initial
version of this change was reviewed.  There is another set in rcorder.

Bruce


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0107232048460.32891-100000>