[m-rev.] for review: add a builtin unsigned word sized integer type -- Part 1

Sebastian Godelet sebastian.godelet at outlook.com
Wed Oct 26 00:50:03 AEDT 2016


Hi,

> > Can I use a recent compiler to compile this commit or would I have to re-
> bootstrap?
> 
> Part 1 of this change can be compiled by any recent compiler.  Part 2
> (which I will hopefully post for review tomorrow) will require a
> bootstrap compiler that includes part 1.  I wouldn't bother doing
> anything with either of them until they've been reviewed and ROTDs
> containing them are available.

OK I'll wait then :)

> 
> > This change does not cover anything along the lines of exposing
> > int32_t and the likes to the C backend, right?
> 
> No, this change introduces word sized unsigned integer types.  In C
> grades, they map on to the runtime's existing MR_Unsigned type.
> 
> There was a discussion in the thread titled "undefined behaviours in
> int.m" about adding fixed size unsigned types.  If / when they're added
> then int32 will map on to int32_t in C grades.
> 
> > Now that we can require C99, that means we can also make use of
> > <inttypes.h>, or is that an not always the case?
> 
> More strictly we're going to require a subset of C99 (since not
> all C compilers support all of it), however inttypes.h and stdint.h
> will be part of that required subset.

That is great news, since I suspect the current string hash function for Mercury strings is suspicable to prefix attacks and int32 addition would help here,
Just as the hash function for Java is implemented.

If that is the case, why not jump to C11 directly, as it already makes certain parts of C99 optional and allows feature detection macros for optional parts.
Although I'm not 100% sure if the already partial implementation of C is good enough in MS VC 2013. It is certainly much better for MS VC 2015.

Cheers,

Sebastian.



More information about the reviews mailing list