[m-rev.] diff: fix runtime compilation with visual c

Julien Fischer juliensf at cs.mu.OZ.AU
Fri Dec 16 00:35:46 AEDT 2005


Estimated hours taken: 0.1
Branches: main

Workaround a problem that occurs when compiling the runtime with
Visual C reported by Paul Massey.

runtime/mercury_memory_zones.c:
	Avoid arithmetic with void pointers because it is a gcc
	extension and breaks compilation of the runtime with Visual C.

Julien.

Index: mercury_memory_zones.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_memory_zones.c,v
retrieving revision 1.26
diff -u -r1.26 mercury_memory_zones.c
--- mercury_memory_zones.c	13 Sep 2005 08:25:39 -0000	1.26
+++ mercury_memory_zones.c	15 Dec 2005 13:17:32 -0000
@@ -554,7 +554,12 @@
         MR_fatal_error(buf);
     }

-    base_incr = new_base - old_base;
+    /*
+    ** XXX the casts to MR_Integer are here because this code was
+    ** relying on the gcc extension that allows arithmetic on void
+    ** pointers - this breaks when compiling with Visual C - juliensf.
+    */
+    base_incr = (MR_Integer)new_base - (MR_Integer)old_base;

     zone->MR_zone_desired_size = new_size;
     zone->MR_zone_bottom = new_base;
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list