[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] LuaClassBasedCall 1.0
- From: liam mail <liam.list@...>
- Date: Sat, 23 Apr 2011 20:54:09 +0100
On Saturday, 23 April 2011, Patrick Rapin <toupie300@gmail.com> wrote:
>> Input makes illegal casts from a void pointer to a function pointer and vice
>> versa,
>
> I didn't know this was illegal. Are there any generic type to which
> one can legally cast
> a pointer to a function? Anyway, in this case, I added lua_CFunction
> to the union.
>
A C function pointer can be a different size from a none function
pointer so it is not safe to store in any other type of pointer, yet
Posix defines that it is valid. A generic function pointer such as
void(*)(void) or a lua_Cfunction is perfectly fine.
>> in addition I would also call into question the functions marked
>> const in (Input::get*) which change the state of union fields.
>
> I don't understand this last remark. In lua::Input, there are only
> Put* members, and
> none modify the union field (or which one?). In lua::Output, there are
> "Get*() const"
> members, which all modify the values pointed to by the PointerValue member,
> but the object itself is not modified.
>
>
Sorry maybe I got the class name mixed up but I do recall there were
constant functions changing the union.
Liam