Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!apple!sun-barr!newstop!sun!sun-bb!khb From: khb@chiba.kbierman@sun.com (Keith Bierman - SPD Advanced Languages) Newsgroups: comp.sys.sgi Subject: Re: Array boundary checking & Fortran <> C translators Message-ID: Date: 2 Feb 90 18:18:37 GMT References: <90Jan25.135818est.57895@ugw.utcs.utoronto.ca> <65973@aerospace.AERO.ORG> Sender: news@sun.Eng.Sun.COM Organization: Sun Microsystems Lines: 37 In-reply-to: tak@aerospace.aero.org's message of 1 Feb 90 17:15:12 GMT In article <65973@aerospace.AERO.ORG> tak@aerospace.aero.org (Michael L. Takayama) writes: If you are calling Fortran subroutines from C, you may want to be aware of the following problem which I ran into: In certain cases, floats do *not* pass correctly to REALs. This problem does not occur with ints to INTEGERs nor with doubles to DOUBLE PRECISIONs. .... Maybe I am doing something illegal here and just got lucky with the ints and doubles passing correctly (I don't think so - I have ... The problem is that K&R C implementations traditionally promote all floats to doubles for both computational and parameter passing purposes. ANSI C "fixes" this, by allowing one to create function prototypes which say explicitly what you want. SunC (pre-ANSI) fixed this with a compiler option (dangerous, breaks linkage to many basic C libraries) and via special macros for the C programmer. Other vendors have provided other solutions over the years. Those doing multi-lingual coding on Unix (pre V.4) may chose to work around the issue by only attempting to pass double and integer data types around. -- Keith H. Bierman |*My thoughts are my own. !! kbierman@Eng.Sun.COM It's Not My Fault | MTS --Only my work belongs to Sun* kbierman%eng@sun.com I Voted for Bill & | Advanced Languages/Floating Point Group Opus | "When the going gets Weird .. the Weird turn PRO" "There is NO defense against the attack of the KILLER MICROS!" Eugene Brooks