lua-users home
lua-l archive

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

On Fri, Mar 17, 2006 at 01:07:59PM +0000, Lisa Parratt wrote:
> >Ok, this is a serious bug in Lua 5.1. It's only visible if
> >sizeof(int)*2 < sizeof(lua_Number). I.e. it probably only affects
> >16 bit CPUs with lua_Number defined as a double.
> ITYM 16 bit CPUs with out of spec C compilers ;) int *should* be 32 
> bits, regardless of the architecture.

"int" is still allowed to be 16 bits in C99.  The minimum magnitues
from section (and Annex E):

               #define INT_MAX                     +32767
               #define INT_MIN                     -32767

If you need a guarantee of at least 32 bits, you have to use long or
perhaps better yet one of the sized typedefs such as int_least32_t.

                                                  -Dave Dodge