Richard Levitte - VMS Whacker wrote:
> The easiest way to avoid the conversions noted above is to have a
> union like this:
> 
>         union foo {
>                 void *simple;
>                 int (*fn)();
>         };
> 
> and use it internally.  You put whatever char * you want to convert to
> a functino pointer into simple and pull out the function pointer from
> fn, and vice versa.

That assumes that the conversion the compiler is attempting to prevent
can actually be done, which is not, of course, a valid assumption. The
only way to do this validly is to make the functions actually take a foo
* as their argument, surely? And yes, then you may end up with a memory
management problem (though often not, coz I'll bet in most cases you can
make the foo static).

Cheers,

Ben.

--
SECURE HOSTING AT THE BUNKER! http://www.thebunker.net/hosting.htm

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

"My grandfather once told me that there are two kinds of people: those
who work and those who take the credit. He told me to try to be in the
first group; there was less competition there."
     - Indira Gandhi
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to