Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Jul 2001 01:09:03 -0500
From:      Alfred Perlstein <bright@sneakerz.org>
To:        Assar Westerlund <assar@FreeBSD.org>
Cc:        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:  <20010723010902.M49508@sneakerz.org>
In-Reply-To: <5lr8v88d1m.fsf@assaris.sics.se>; from assar@FreeBSD.org on Mon, Jul 23, 2001 at 06:49:57AM %2B0200
References:  <assar@FreeBSD.org> <200107230223.f6N2Nfg14201@hak.lan.Awfulhak.org> <20010722223812.L49508@sneakerz.org> <5lr8v88d1m.fsf@assaris.sics.se>

next in thread | previous in thread | raw e-mail | index | archive | help
* Assar Westerlund <assar@FreeBSD.org> [010722 23:49] wrote:
> Alfred Perlstein <bright@sneakerz.org> writes:
> > I think that e*() shouldn't be encouraged, but it would be useful to
> > remove the N redundant copies of it that we have in our tree.
> 
> Why should it be discouraged?  Or rather, what she the code in the
> tree that already does exactly this do?
> 
> > Perhaps the manpages can discourage use of it, explaining that
> > exiting is not coping with a problem?  I think that would solve
> > all of our concerns as well as allow us to remove duplicated code.
> 
> `Only use these functions when the only action on failure is to exit
> the program' ?

s/exit/when there is no state that might need recovering from/

Basically, any subroutines that may fail for one reason or another
_and_ use these functions become cancellation points, meaning they
are unsafe to call if there is any in progress transactions that
may need cleanup.  It taints code. :(

I'd really hate to see anyone base any library upon using these
functions.  My code can recover from errors and it would be a shame
to see libraries that choose to bail in such a manner instead of
recovering and returning an error such as ENOMEM which will actually
be returned if the libarary returns immediately after failure since
errno shouldn't be tainted.

-- 
-Alfred Perlstein [alfred@freebsd.org]
Ok, who wrote this damn function called '??'?
And why do my programs keep crashing in it?

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?20010723010902.M49508>