[GUI] Re: HToolkit binary compatibility

Marcin 'Qrczak' Kowalczyk qrczak@knm.org.pl
Mon, 11 Aug 2003 00:32:03 +0200


Dnia nie 10. sierpnia 2003 23:45, Wolfgang Jeltsch napisał:

> If void * was realized such that function pointers
> as well as data pointers could be safely cast to void * and back²)

Function pointers are not required to fit in void *. In particular I believe 
that DOS compilers you mention had void * of the size of data pointers.

Function pointers can be freely cast between other function pointer types.
They must only be cast back to the correct type before using. So any function 
pointer type can be used for generic function pointers - with explicit casts 
though, unlike void * for data pointers.

> ¹) This assumes that the stack, the global data and the heap all resided in
> the data segment. I'm not completely sure if this was the case in the small
> model.

It was; otherwise data pointers couldn't be 16 bit and we would gain nothing.

-- 
   __("<         Marcin Kowalczyk
   \__/       qrczak@knm.org.pl
    ^^     http://qrnik.knm.org.pl/~qrczak/