Path: utzoo!utgpu!watserv1!watcgl!fjhenigman From: fjhenigman@watcgl.waterloo.edu (Frank J. Henigman) Newsgroups: comp.sys.sgi Subject: Re: Array boundary checking & Fortran <> C translators Message-ID: <13215@watcgl.waterloo.edu> Date: 2 Feb 90 19:15:52 GMT References: <90Jan25.135818est.57895@ugw.utcs.utoronto.ca> <65973@aerospace.AERO.ORG> Reply-To: fjhenigman@watcgl.waterloo.edu (Frank J. Henigman) Organization: U. of Waterloo, Ontario Lines: 35 Your problem arises from the fact that the C compiler does not allow floats as formal parameters - they are converted to doubles. Thus, the variable "b" in "subtestc" is actually a double even though it is declared as float. The following code demonstrates this behaviour. ----------------------------------------------------------------------------- bar(fp) float *fp; { printf("%f <--- `wrong'\n", *fp); } foo(fpf) float fpf; { bar(&fpf); } main() { float f = 9876.1234; printf("%f <--- right\n", f); foo(f); } ----------------------------------------------------------------------------- 9876.123047 <--- right 6.102790 <--- `wrong' -- fjhenigman@watcgl.uwaterloo.ca Computer Graphics Lab fjhenigman@watcgl.waterloo.edu Frank J. Henigman University of Waterloo ...!watmath!watcgl!fjhenigman Waterloo, Ontario, Canada