lua-users home
lua-l archive

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


* Mike Pall:

>> Does that mean that C modules that use light userdata to store size_t
>> integers (for example for bitfields) will have the upper 16bits
>> clamped ? For the moment I'm mostly concerned by the win32 API, which
>> uses the UINT_PTR type quite often. However in the partial bindings I
>> have so far all enum and bitfield types are 32bits (mostly DWORD).
>
> What you're intending to do is not covered by any C standard.

There's MAP_FAILED, which is returned by mmap as a void * and has a
peculiar bit pattern.

But the AMD64 ABI clearly says that this is not allowed ("Although the
AMD64 architecture uses 64-bit pointers, implementations are only
required to handle 48-bit addresses. Therefore, conforming processes
may only use addresses from 0x00000000 00000000 to 0x00007fff
ffffffff. [Footnote: 0x0000ffff ffffffff is not a canonical address
and cannot be used.]").  Oh well.