[m-rev.] for review: fix discrepancy in definition and documentation of MR_Char
Peter Wang
novalazy at gmail.com
Wed Oct 7 17:58:46 AEDT 2026
On Wed, 07 Oct 2026 17:39:20 +1100 Julien Fischer <jfischer at opturion.com> wrote:
> 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;
In the original patch (Message-ID <20110327234709.GR17048 at plug.localdomain>)
I had redefined MR_Char to int, and MR_UnsignedChar to unsigned int.
After your review, I only changed the documentation in mercury_string.h
to say MR_[u]int_least32_t, but not the typedef in mercury_types.h.
Seems like it was just a sloppy mistake.
Peter
More information about the reviews
mailing list