[m-dev.] Adding standard integer types

Paul Bone pbone at csse.unimelb.edu.au
Wed Sep 17 14:47:21 AEST 2008

On Wed, Sep 17, 2008 at 02:07:50PM +1000, Peter Ross wrote:
> I'm looking at adding the type int8, int16, int32 and int64 to Mercury
> and the equivalent unsigned versions.
> The way I'm currently imagining doing it is to add the following
> module to the library.
> :- module stdint.
> :- interface.
> :- type int8.
> :- foreign_type(c, int8, "int8_t").
> :- func to_int8(int) = int8.
> I will then add to the runtime the following portable stdint.h renamed
> to mercury_pstdint.h
> http://www.azillionmonkeys.com/qed/pstdint.h
> and add to configure a test for stdint.h and if that doesn't exist we
> would fall back to using mercury_pstdint.h.
> Does anyone have any objections/improvements to this plan?

The declartive debugger embeds a bytecode representation of the program
inside the compiled program.  This contains many stdint-like integers,
and code for writting them to byte sequences in a portable way.  If this
is relevant you should check it out.

Once your stdint module is implemented it may be good to port things
like the declartive debugger's bytecode represenation to it's
definition of these integers.

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

More information about the developers mailing list