lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Tue, Mar 8, 2011 at 11:30 AM, liam mail <liam.list@googlemail.com> wrote:
> Just a note to say that a function pointer and void pointer have
> no guarantees to be the same size.

If that is an issue for the OP, don't use lightuserdata, an alternate
technique is to use the fn ptr value encoded as a hex string.

While ANSI allows sizeof(void (*)()) to be > sizeof(void*), its pretty
unusual (I've never seen it). IIRC, traditional/pre-ANSI C required
any ptr, including functions pointers, to be castable to void* without
loss.

Cheers,
Sam