Return-Path: Delivered-To: new-httpd-archive@hyperreal.org Received: (qmail 10824 invoked by uid 6000); 1 Feb 1999 17:36:09 -0000 Received: (qmail 10817 invoked from network); 1 Feb 1999 17:36:08 -0000 Received: from twinlark.arctic.org (204.107.140.52) by taz.hyperreal.org with SMTP; 1 Feb 1999 17:36:08 -0000 Received: (qmail 1008 invoked by uid 500); 1 Feb 1999 17:35:56 -0000 Date: Mon, 1 Feb 1999 09:35:56 -0800 (PST) From: Dean Gaudet To: new-httpd@apache.org Subject: Re: [APR] Universal return syntax In-Reply-To: Message-ID: X-Comment: Visit http://www.arctic.org/~dgaudet/legal for information regarding copyright and disclaimer. MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: new-httpd-owner@apache.org Precedence: bulk Reply-To: new-httpd@apache.org On Tue, 26 Jan 1999, Ryan Bloom wrote: > As one of the writers of the original document, I was hoping for > acceptance of the always return an APRStatus. However, you have convinced > me this is not a great idea, so I have another thought. I would much rather have a simple integer APRStatus than some of the other proposals floating around. That is, my first choice is: - result = f(); /* int errno in thread-local-storage */ This method does not force every function to have a stack frame. The cost of the second return value is essentially the same as the cost of thread-local storage access -- which is something the kernel/libc folks have to optimize... and they can optimize it because they know the architecture and don't have to worry about portability. The simplicity of an integer errno means at no time will any CPU be wasted setting up strings and a structure which aren't going to be used. and my second choice is: - int errno = f(&result); This method costs a stack frame for all functions, no matter how small, using APR. But maintains the simplicity of an enumerated error type. In any case I strongly advocate that a single comparison *against zero* be sufficient to answer the question "did an error occur?" This is the most portable fast comparison. (This isn't true of the current APRStatus proposal.) And uh, I'm sorry for dragging this debate out. Dean