[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Ordered keys patch for lua-5.1.4 (+extra junk)
- From: Dave Dodge <dododge@...>
- Date: Fri, 8 Jan 2010 18:26:48 -0500
On Fri, Jan 08, 2010 at 11:54:34AM -0200, Roberto Ierusalimschy wrote:
> > I'll admit that the casting chain isn't pretty; but it is reliable
> > as far as I can tell.
>
> Generally, this construction is not reliable:
POSIX recommends this approach to avoid the conversion warning:
int (*fptr)(int);
*(void**)(&fptr) = dlsym(handle,"my_function");
This is undefined in pure C, but dlsym is part of the POSIX XSI
extension and on an XSI-conforming system the conversions are required
to be defined. You can find the IEEE discussion of the issue at:
http://standards.ieee.org/reading/ieee/interp/1003.1-2001/1003.1-2001-03.html
-Dave Dodge