[m-rev.] diff: IL back-end: fix bug B4

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Oct 22 03:26:48 AEST 2002


This patch fixes bug B4 from the list that I posted of failures in grade `il'
<http://www.cs.mu.oz.au/research/mercury/mailing-lists/mercury-developers/mercury-developers.0210/0059.html>

Estimated hours taken: 0.5
Branches: main

Fix a bug that broke tests/general/string_to_float in il* grades.

library/string.m:
	When calling System.Convert.ToDouble(), catch System.FormatException
	rather than System.InvalidCastException.

Workspace: /home/ceres/fjh/mercury
Index: library/string.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/string.m,v
retrieving revision 1.177
diff -u -d -r1.177 string.m
--- library/string.m	16 Oct 2002 15:47:19 -0000	1.177
+++ library/string.m	21 Oct 2002 17:16:56 -0000
@@ -1862,10 +1862,13 @@
 :- pragma foreign_proc("MC++",
 	string__to_float(FloatString::in, FloatVal::out),
 		[will_not_call_mercury, promise_pure, thread_safe], "{
+	/*
+	** XXX should we also catch System::OverflowException?
+	*/
 	SUCCESS_INDICATOR = MR_TRUE;
 	try {
 	    FloatVal = System::Convert::ToDouble(FloatString);
-	} catch (System::InvalidCastException *e) {
+	} catch (System::FormatException *e) {
 	     SUCCESS_INDICATOR = MR_FALSE;
 	}
 }").

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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