On Tue, Jan 18, 2000 at 10:59:53AM +0100, Richard Levitte - VMS Whacker wrote:
>> bit data pointers). To force C to convert values between
>> these types, you'd have to cast to some integer type inbetween:
>> (void (*)()) (long) cb
> This may very well be a problem on architectures where a pointer is 64
> bits while a long is 32 bits.
Exactly, which is why compilers should complain when someone attempts
to do such things (with just one cast, as in OpenSSL -- two casts as
above tell the compiler that the user pretends to know what he is
doing).
>> But of course this is so complicated because it should never
>> be done and is not guaranteed to do anything useful. &cb,
>> on the other hand, is the pointer to some data object; the
>> function that gets this pointer as an argument has to
>> retrieve the actual function pointer from inside this data
>> object, i.e. use *((void (**)()) arg) where arg is the void
>> * argument passed to it.
> I was pondering such a solution, but I foresaw a problem with it:
> &strcmp is the same as strcmp, and that might be a difficult bug to
> find...
I see, this could become a problem (when using over-tolerant compilers
that don't print warnings for such conversions).
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]