Return-Path: Delivered-To: apmail-apr-dev-archive@www.apache.org Received: (qmail 18506 invoked from network); 17 Aug 2005 06:41:01 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 17 Aug 2005 06:41:01 -0000 Received: (qmail 25746 invoked by uid 500); 17 Aug 2005 06:41:01 -0000 Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 25411 invoked by uid 500); 17 Aug 2005 06:40:59 -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 25394 invoked by uid 99); 17 Aug 2005 06:40:59 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Aug 2005 23:40:59 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of jorton@redhat.com designates 66.187.233.31 as permitted sender) Received: from [66.187.233.31] (HELO mx1.redhat.com) (66.187.233.31) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Aug 2005 23:41:18 -0700 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11/8.12.11) with ESMTP id j7H6euTi012499 for ; Wed, 17 Aug 2005 02:40:56 -0400 Received: from radish.cambridge.redhat.com (radish.cambridge.redhat.com [172.16.18.90]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id j7H6etV21362 for ; Wed, 17 Aug 2005 02:40:56 -0400 Received: (from jorton@localhost) by radish.cambridge.redhat.com (8.13.4/8.13.4/Submit) id j7H6etmE020341 for dev@apr.apache.org; Wed, 17 Aug 2005 07:40:55 +0100 X-Authentication-Warning: radish.cambridge.redhat.com: jorton set sender to jorton@redhat.com using -f Date: Wed, 17 Aug 2005 07:40:55 +0100 From: Joe Orton To: dev@apr.apache.org Subject: Re: APR_ARRAY_FOO convenience macros Message-ID: <20050817064055.GB19961@redhat.com> Mail-Followup-To: dev@apr.apache.org References: <43014E5D.9080008@electricjellyfish.net> <6.2.1.2.2.20050816014759.071c1e30@pop3.rowe-clan.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <6.2.1.2.2.20050816014759.071c1e30@pop3.rowe-clan.net> User-Agent: Mutt/1.4.2.1i X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N On Tue, Aug 16, 2005 at 01:49:55AM -0500, William Rowe wrote: > At 09:24 PM 8/15/2005, Garrett Rooney wrote: > >So back in Dec 2003 Sander Striker suggested [1] adding Subversion's macros for manipulating apr arrays (APR_ARRAY_IDX, which automates the casting needed to access entries in the array, and APR_ARRAY_PUSH, which automates the casting needed to add entries to the array) to apr_tables.h. Roy Fielding commented [2] that he felt the macros tied the interface to the implementation too much, and Greg Stein replied [3] that they had to be done as macros, not functions, because of the need to pass a type name for the cast. > > IIUC, these are not typesafe? APR arrays are fundamentally not type-safe object stores. In case it's not clear, these are the macros in question: /** index into an apr_array_header_t */ #define APR_ARRAY_IDX(ary,i,type) (((type *)(ary)->elts)[i]) /** easier array-pushing syntax */ #define APR_ARRAY_PUSH(ary,type) (*((type *)apr_array_push (ary))) joe