[MLton] Building MLton

Wesley W. Terpstra wesley@terpstra.ca
Mon, 4 Jul 2005 16:23:34 +0200


On Mon, Jul 04, 2005 at 04:29:55PM +0300, Vesa Karvonen wrote:
> In summary, if you want to manipulate array (object) indices and
> sizes, you should be using ptrdiff_t and size_t. 

If you want to hold (void) pointers, you should use uintptr_t (XSI).

> If you want to manipulate exactly 64-bit integers, you should be using
> int64_t and uint64_t (although it is possible that a C implementation does
> not have exactly 64-bit integers).

POSIX guarantees 8, 16, and 32. 
If any type is >= 64 bit, then 64 is required too.

I think for MLton, relying on the X/Open (> POSIX) standard is reasonable.
If parts are missing (like under cygwin+mingw) MLton can always special-case
things the way it already does.

> If you want to manipulate at least 64-bit integers you should be using
> (unsigned) long long int.

You should use uint_least64_t actually.

But... I think this whole discussion misses the point that the MLton
compiler does it's own data layout. It doesn't use C's types except at
interface boundaries. So, using a portable C type is not helpful.

The problem of 64-bit for MLton is one of teaching the compiler to pack
bigger pointers, and the runtime to interact properly with it. 

Wesley W. Terpstra