[m-dev.] for review: add MR_ to Word, Integer, String, etc...

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Aug 1 15:09:45 AEST 2000


On 01-Aug-2000, Tyson Dowd <trd at cs.mu.OZ.AU> wrote:
> Index: runtime/mercury_bootstrap.h
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/runtime/mercury_bootstrap.h,v
> retrieving revision 1.14
> diff -u -r1.14 mercury_bootstrap.h
> --- runtime/mercury_bootstrap.h	2000/05/08 13:48:44	1.14
> +++ runtime/mercury_bootstrap.h	2000/07/28 01:47:59
> @@ -23,8 +23,28 @@
>  
>  #define MR_TypeCtorInfo_struct  MR_TypeCtorInfo_Struct
>  
> +
>  #ifndef MR_NO_BACKWARDS_COMPAT
>  
> +/* 
> +** For a long time the Mercury C types were defined as Char, Float,
> +** Integer, Word, etc.  There will doubtless be lots of C code in
> +** libraries that relies upon these names.  
> +*/
> +
> +#define Word 		MR_Word
> +#define Code 		MR_Code
> +#define Char 		MR_Char
> +#define Float 		MR_Float
> +#define Float64 	MR_Float64
> +#define Integer 	MR_Integer
> +#define Unsigned 	MR_Unsigned
> +#define UnsignedChar 	MR_UnsignedChar
> +#define String 		MR_String
> +#define ConstString 	MR_ConstString

You should use `typedef' rather than `#define' here.
In general it's better to use `typedef' rather than `#define',
since macros don't respect scopes and thus cause more name
clash problems than typedefs, and in this particular case
the names were originally typedefs, so defining them as
macros could cause problems.

> +#define Bool 		MR_Bool

Shouldn't that be `bool' rather than `Bool'?

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list