[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: LuaJIT FFI: Semantics of undefined numeric conversions (e.g. huge double to int)
- From: Mike Pall <mikelu-1109@...>
- Date: Mon, 19 Sep 2011 18:16:04 +0200
Philipp Kutin wrote:
> OK, that's good to know, even though it means that pretty much all
> functions will have to be wrapped.
Not to stop your endeavors, but you realize that most of Lua's
standard library has exactly the same issues? Do you really want
to wrap e.g. every call to string.sub() just because both rounding
and overflow for its arguments is undefined and platform-dependent?
Dumbing down an API has never been a good idea. Users that don't
even know what 'undefined' means will find clever ways to
circumvent all of your brittle safety nets just by accident.
However all of your users, even the experts, will suffer from
pointless wrappers.
I suggest to educate your users and/or stop worrying too much. :-)
> So, can something like the following be added to the spec?:
>
> "
> ... it closely follows the C language semantics, wherever possible.
> Specifically, <this and that> should be considered undefined
> behaviour as per C standard.
> "
Sorry, no. Because <this and that> would amount to paraphrasing a
substantial amount of the C standards. I guess that would be more
text than the whole page has right now.
--Mike