[m-rev.] for review: fix discrepancy in definition and documentation of MR_Char

Julien Fischer jfischer at opturion.com
Wed Oct 7 17:39:20 AEDT 2026


For review by Peter.

Is there a reason for the discrepancy below? It's been that way since MR_Char
was redefined in commit 3788a9d6f.
(Obviously defining MR_Char as int is currently harmless since that's 32-bit
type on all of our supported platforms anyway.)

---------------------------------------------

Fix discrepancy in definition and documentation of MR_Char.

mercury_types.h defines MR_Char as a typedef for int and MR_UnsignedChar
as a typedef for unsigned int. mercury_string.h documents them as being
typedefs for MR_int_least32_t and MR_uint_least32_t respectively.
Use the latter definition in both places

runtime/mercury_types.h:
    As above.

Julien.

diff --git a/runtime/mercury_types.h b/runtime/mercury_types.h
index 85ae23c91..d9be7ed42 100644
--- a/runtime/mercury_types.h
+++ b/runtime/mercury_types.h
@@ -110,8 +110,8 @@ typedef MR_Code                 *MR_CodePtr;
 // They are defined here to avoid problems with circular #includes.
 // If you modify them, you will need to modify mercury_string.h as well.

-typedef int             MR_Char;
-typedef unsigned int    MR_UnsignedChar;
+typedef MR_int_least32_t    MR_Char;
+typedef MR_uint_least32_t   MR_UnsignedChar;

 typedef char            *MR_String;
 typedef const char      *MR_ConstString;


More information about the reviews mailing list