From owner-cvs-all Sun Jul 22 23: 9:25 2001 Delivered-To: cvs-all@freebsd.org Received: from sneakerz.org (sneakerz.org [216.33.66.254]) by hub.freebsd.org (Postfix) with ESMTP id 84E2537B401; Sun, 22 Jul 2001 23:09:13 -0700 (PDT) (envelope-from bright@sneakerz.org) Received: by sneakerz.org (Postfix, from userid 1092) id 124E05D01F; Mon, 23 Jul 2001 01:09:03 -0500 (CDT) Date: Mon, 23 Jul 2001 01:09:03 -0500 From: Alfred Perlstein To: Assar Westerlund Cc: Brian Somers , 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> References: <200107230223.f6N2Nfg14201@hak.lan.Awfulhak.org> <20010722223812.L49508@sneakerz.org> <5lr8v88d1m.fsf@assaris.sics.se> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2i In-Reply-To: <5lr8v88d1m.fsf@assaris.sics.se>; from assar@FreeBSD.org on Mon, Jul 23, 2001 at 06:49:57AM +0200 Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG * Assar Westerlund [010722 23:49] wrote: > Alfred Perlstein 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