Joe Orton wrote:
On Fri, Feb 06, 2004 at 10:06:14AM +0000, Ben Laurie wrote:
Surely the point is that the function and the function pointer actually _do_ have compatible types, but we hold the pointer in a variable that doesn't. That is, we cast it to an incompatible type for storage, then cast it back.

The issue is the call to apr_dynamic_fn_register, here's how I read it:

(((void (*)(const char *, APR_OPTIONAL_FN_TYPE(name) *)) &apr_dynamic_fn_register)(#name,name))

this takes a function pointer (&apr_dynamic_fn_register), then casts it
to a different type (void (*)(const blah blah)), then calls the function
using this type. That has undefined behaviour, since the type of
apr_dynamic_fn_register is not compatible with the (void (*)(const blah
blah) type.

I misunderstood, sorry.

Cheers,

Ben.

--
http://www.apache-ssl.org/ben.html       http://www.thebunker.net/

"There is no limit to what a man can do or how far he can go if he
doesn't mind who gets the credit." - Robert Woodruff

Reply via email to