On 02-Jan-2001, Marcin 'Qrczak' Kowalczyk <[EMAIL PROTECTED]> wrote:
> 
> Null function pointers are a non-portable concept - ANSI C does not have
> them, only null data pointers.  But many existing C interfaces use them,

You're mistaken -- ANSI/ISO C definitely does have null function pointers.
So it's not suprising that many existing C interfaces use them.

> and even the ability to cast between data pointers and function pointers
> is described as a common non-standard extension in ISO/ANSI C99.

That's true. ANSI/ISO C does not guarantee that a data pointer will
fit in a function pointer or vice versa.

If you want something that could be either a data pointer or
a function pointer, you need to use a union:

        union {
                void *data;
                void (*func)(void);
        }

-- 
Fergus Henderson <[EMAIL PROTECTED]>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.

_______________________________________________
FFI mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/ffi

Reply via email to