[KinoSearch] Towards a stable C API... via indirect dispatch

Nathan Kurz nate at verse.com
Mon Oct 29 11:52:03 PDT 2007



On 10/28/07, Marvin Humphrey <marvin at rectangular.com> wrote:
>
> On Oct 28, 2007, at 9:05 AM, Aaron Crane wrote:
>
> > Theoretically, object pointers (including void pointers) and function
> > pointers are incommensurate according to the C standard -- you get
> > undefined behaviour when you cast between them.
...
> It seems to me that the only way to get away with using the array
> rather than the struct containing the array involves some nasty
> casting hacks.  Worth it, y'think?

I hadn't been aware of the potential incompatibility between function
and object pointers in C.  Thanks!

On the other hand, on doing some more research, I don't think this is
much of a concern in practice.  I can't find primary sources, but I
find many claims that both Posix and Win32  require that they be
interchangeable.

My preference would be for using whatever is simpler and clearer to
read, so long as it compiles without warning on our target systems and
is not unreasonably ineffecient.  My semi-informed guess is that
sticking with the current array approach is best.

Nathan Kurz
nate at verse.com

_______________________________________________
KinoSearch mailing list
KinoSearch at rectangular.com
http://www.rectangular.com/mailman/listinfo/kinosearch




More information about the kinosearch mailing list