[m-dev.] diff: add parentheses to macro definition

David Glen JEFFERY dgj at cs.mu.OZ.AU
Wed Jan 19 15:15:09 AEDT 2000


On 15-Jan-2000, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> 
> > > +#define MR_TYPE_VARIABLE_IS_EXIST_QUANT(T)      ( (Word) T > MR_EXISTENTI
>        AL_VAR_BASE )
> > > +#define MR_TYPE_VARIABLE_IS_UNIV_QUANT(T)       ( (Word) T <= MR_EXISTENT
>        IAL_VAR_BASE )
> > 
> > Shouldn't that be `>=' and `<' rather than `>' and `<='?
> 
> No, the comparisons are correct. David should wrap the Ts in ()s, though.


===================================================================

Estimated hours taken: 0.1

runtime/mercury_type_info.h:
	Add parentheses to make a macro safer.

===================================================================

cvs diff: Diffing .
Index: mercury_type_info.h
===================================================================
RCS file: /home/staff/zs/imp/mercury/runtime/mercury_type_info.h,v
retrieving revision 1.36
diff -u -t -r1.36 mercury_type_info.h
--- mercury_type_info.h 2000/01/13 03:57:19     1.36
+++ mercury_type_info.h 2000/01/18 03:19:40
@@ -305,8 +305,10 @@
 
 #define MR_EXISTENTIAL_VAR_BASE                 512
 
-#define MR_TYPE_VARIABLE_IS_EXIST_QUANT(T)      ( (Word) T > MR_EXISTENTIAL_VAR
_BASE )
-#define MR_TYPE_VARIABLE_IS_UNIV_QUANT(T)       ( (Word) T <= MR_EXISTENTIAL_VA
R_BASE )
+#define MR_TYPE_VARIABLE_IS_EXIST_QUANT(T)      \
+        ( (Word) (T) > MR_EXISTENTIAL_VAR_BASE )
+#define MR_TYPE_VARIABLE_IS_UNIV_QUANT(T)       \
+        ( (Word) (T) <= MR_EXISTENTIAL_VAR_BASE )
 
 /*
  *  ** This constant is also used for other information - for

cvs diff: Diffing GETOPT
cvs diff: Diffing machdeps


dgj
-- 
David Jeffery (dgj at cs.mu.oz.au) | If your thesis is utterly vacuous
PhD student,                    | Use first-order predicate calculus.
Dept. of Comp. Sci. & Soft. Eng.|     With sufficient formality
The University of Melbourne     |     The sheerist banality
Australia                       | Will be hailed by the critics: "Miraculous!"
                                |     -- Anon.
--------------------------------------------------------------------------
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