Return-Path: Delivered-To: apmail-apr-dev-archive@www.apache.org Received: (qmail 58103 invoked from network); 12 May 2005 02:05:01 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 12 May 2005 02:05:01 -0000 Received: (qmail 8198 invoked by uid 500); 12 May 2005 02:08:26 -0000 Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 8113 invoked by uid 500); 12 May 2005 02:08:26 -0000 Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Id: Delivered-To: mailing list dev@apr.apache.org Received: (qmail 8059 invoked by uid 99); 12 May 2005 02:08:25 -0000 X-ASF-Spam-Status: No, hits=0.1 required=10.0 tests=FORGED_RCVD_HELO X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from thunderer.concentric.net (HELO thunderer.cnchost.com) (207.155.252.72) by apache.org (qpsmtpd/0.28) with ESMTP; Wed, 11 May 2005 19:08:25 -0700 Received: from rcsv650.rowe-clan.net (c-24-13-128-132.hsd1.il.comcast.net [24.13.128.132]) by thunderer.cnchost.com id WAA13611; Wed, 11 May 2005 22:04:26 -0400 (EDT) [ConcentricHost SMTP Relay 1.17] Errors-To: Message-Id: <6.2.1.2.2.20050511205411.042b45b0@pop3.rowe-clan.net> X-Mailer: QUALCOMM Windows Eudora Version 6.2.1.2 Date: Wed, 11 May 2005 20:56:30 -0500 To: wes@page.ca From: "William A. Rowe, Jr." Subject: Re: advice on use of APR_STATUS_IS_* Cc: Randy Kobes , dev@apr.apache.org In-Reply-To: References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N IIUC, if you look, there are groups of status results under a single case. This is especially true on OS/X and Win32. But even on unix; consider /** operation would block */ #if !defined(EWOULDBLOCK) || !defined(EAGAIN) #define APR_STATUS_IS_EAGAIN(s) ((s) == APR_EAGAIN) #elif (EWOULDBLOCK == EAGAIN) #define APR_STATUS_IS_EAGAIN(s) ((s) == APR_EAGAIN) #else #define APR_STATUS_IS_EAGAIN(s) ((s) == APR_EAGAIN \ || (s) == EWOULDBLOCK) #endif which deals with this fundemental discrepancy between implementations. At 08:38 PM 5/11/2005, Wesley W. Garland wrote: >Aside from stylistic consistency, I can't see a compelling reason for >using the APR_STATUS_IS_* macro group -- and I think a viable case >could be made for avoiding them entirely for a fresh codebase. (For >example, I have 49,773 lines of apr-centric application code here... >and zero lines where APR_STATUS_IS_* appears). > >If I was working on PERL APR:: bindings, I would choose whatever is >the best expression for the language. Not knowing PERL, I can't really >comment there. > >For what it's worth, I feel fairly strong about using two types of return calls: > >1. check against != APR_SUCCESS >2. check using switch() with a default: case > >...and I really hate unnecessary macros. > >But this is more of a religious discussion than an APR discussion, so >I won't expound further. :) > >Wes > >On 5/8/05, Randy Kobes wrote: >> mod_perl 2 supplies some APR::* modules for binding to apr, >> and a question has arisen regarding checking error codes >> against the appropriate APR_* constants. In apr_errno.h >> there are warnings about using the corresponding >> APR_STATUS_IS_* macros, as there could be more than one >> variant satisfying an error condition (eg, >> APR_STATUS_IS_ENOENT). There are a number of cases though >> for which at present there's only one such condition (eg, >> APR_STATUS_IS_EOF). What we were wondering is if the >> APR_STATUS_IS_* macros are still strongly recommended to use >> in cases where there is only one variant? Or, for such >> cases, has common useage become just to compare against the >> corresponding APR_* constant (eg, APR_EOF)? Thanks very >> much. >> >> -- >> best regards, >> randy kobes >> > > >-- >Wesley W. Garland >Director, Product Development >PageMail, Inc. >+1 613 542 2787 x 102