[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: problem with formatting large integers
- From: Josh Haberman <jhaberman@...>
- Date: Sat, 16 Apr 2011 16:21:20 +0000 (UTC)
> > There's hardly a genuine situation in which
> >
> > string.format( "%i", 2^31 ) --> -2147483648
> >
> > is a reasonable or desirable outcome?
>
> Lua (as everything else) is a tradeoff between several conflicting
> goals. I do not think this problem is worth the complexity of its
> fix. If you want %.0f when you write "%i", write "%.0f".
One thing I would note is that most systems these days do
support "long long," and it is part of C99. Is there any reasonable
way given Lua's build system to compile with LUA_USELONGLONG
by default on systems where it is supported?
GCC has supported "long long" since at least 2.95.3 (2001), which
was the oldest manual I could find online, so it seems that
LUA_USELONGLONG could be the default for at least:
- make linux
- make macosx
- make freebsd
Josh