lua-users home
lua-l archive

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


Am 02.12.2013 18:54 schröbte Coda Highland:
On Mon, Dec 2, 2013 at 9:46 AM, Lourival Vieira Neto
<lourival.neto@gmail.com> wrote:
Hi Folks,

Why use 'long long' instead of int64_t for lua_Integer?

The 5.3 manual is still referring ptrdiff_t for lua_Integer, in
section 4.8 [1]. It should be defined as 'long long' there, right?

[1] http://www.lua.org/work/doc/manual.html#4.8

Regards,
--
Lourival Vieira Neto


Simple answer: int64_t is C99, Lua tries to stay compatible with C89.

... and although "long long" is not in C90 either, it was implemented as an extension by many C90 compilers (and C++, I believe) before the C99 standard was defined. Also, "long long" is not required to be 64 bits wide (but it is at least as wide as a "long"). "ptrdiff_t" on the other hand *is* in C90 and has a good chance to be 64 bits on a machine that supports 64 bit addresses.


/s/ Adam


Philipp