apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brian W. Fitzpatrick" <f...@red-bean.com>
Subject Re: APR_ARRAY_FOO convenience macros
Date Thu, 18 Aug 2005 04:06:07 GMT

On Aug 17, 2005, at 10:47 PM, Branko ─îibej wrote:

> Cliff Woolley wrote:
>
>
>> On Wed, 17 Aug 2005, Joe Orton wrote:
>>
>>
>>
>>> 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)))
>>>
>>>
>>
>> I'm fine with adding these.  +1
>>
>>
> +1, in case we need another vote. I know we'd go barmy in SVN  
> without these macros.

+1 indeed.

-Fitz, who had to look up "barmy"

PS http://www.answers.com/barmy&r=67
Mime
View raw message