lua-users home
lua-l archive

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


> BTW I wonder if this issue is going to be fixed in some way in
> 5.2.0. Lua team hasn't commented on the subject so I wonder whether
> it is considered a bug to be squashed in the official distro, or it
> is to be viewed simply as a "platform idiosyncrasy" to be coped with
> downstream.

We added a note in the manual about the limits of integer formats, but
I am not sure we will do anything else. There are many places where the
same problem occurs (basically everywhere that C code uses an int):

  > return string.sub("Hello", 2^32 + 2, 2^32 + 3)
  el
  > print(unpack({1,2,3}, 1, 2^32 + 2))
  1        2


The ".0f" trick works neither for "%d" with a precision nor for "%x" and
"%o".  Tests everywhere will add size, complexity, and slow down the
interpreter. We need to compromise somewhere. We may add an explicit
test only for 'format', but I am not sure why it deserves a protection
more than the other functions.

-- Roberto