[m-dev.] What's the deal with integer types in Mercury's C source.

Paul Bone pbone at csse.unimelb.edu.au
Fri Sep 9 15:37:38 AEST 2011


Hi guys.

In C source we often use MR_Integer and MR_Unsigned, these are guaranteed to be
at least pointer-sized.  We also use MR_uint_least32_t and friends when we want
something at least that particular size.

I want an integer that is exactly 32 bits on 32 and 64 bit platforms.  I'm
trying to make some inline assembler things as compatible as possible with
different C compilers on i386 and x86_64.  The assembly code it's self is
compatible with either i386 or x86_64 but I'd also like it's parameter to be
exactly 32 bits to match the operand size I'm using in the assembly code.

How portable is uint32_t?  Or should I use some other type to get _exactly_ a
32bit unsigned int?

Thanks.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
URL: <http://lists.mercurylang.org/archives/developers/attachments/20110909/7f4a41c1/attachment.sig>


More information about the developers mailing list