apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <wr...@rowe-clan.net>
Subject Re: APR_ARRAY_FOO convenience macros
Date Wed, 17 Aug 2005 02:51:54 GMT
At 11:08 AM 8/16/2005, Garrett Rooney wrote:
>William A. Rowe, Jr. wrote:
>>
>>IIUC, these are not typesafe?
>>See the apr optional function and hook apis for true typesafe
>>casts.
>
>I must be missing something, but I don't see how these macros could be implemented in
a more typesafe way.  Could you elaborate?
>
>The hooks code appears to be a means to store arbitrary functions and then retrieve them
later, are you suggesting that separate functions for manipulating each type of array be created
dynamically or something?  I guess I'm just failing to see how such a thing would really work
in practice, or I'm just misunderstanding what you're suggesting.

Yes, but (especially registered functions) allow you to set
up an argument type/argument list by casting a function ptr,
rather than the actual data object.  This means that every
invocation of APR_FN_type_FOO will accept only a certain type,
enforcing typesafety.

Ben went to the trouble of figuring it out (brilliant!) so
I'd happily veto wrappers which don't enforce type safety.
I don't want to return to the 1.3 mod_ssl days (of a new
fn for each arg list) after we have such an elegant solution
at hand :)  Take some time to grok

  http://svn.apache.org/repos/asf/apr/apr-util/trunk/include/apr_optional_hooks.h

Bill  


Mime
View raw message