Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!sdd.hp.com!think.com!snorkelwacker.mit.edu!shelby!unix!hplabs!hpfcso!cunniff From: cunniff@hpfcso.HP.COM (Ross Cunniff) Newsgroups: comp.sys.amiga.programmer Subject: Re: SAS Bugs Message-ID: <101060007@hpfcso.HP.COM> Date: 4 Feb 91 18:35:38 GMT References: <91028.004246T32QC@CUNYVM.BITNET> Organization: Hewlett-Packard, Fort Collins, CO, USA Lines: 33 >>Well, this weekend, I just got bitten by the following nasty bug ... >> func( a, b ) >> float a; >> long *b; >> { >> *(float *)b = a; >> } >> >> [ explains how compiler thinks a is the size of a double ] > This is NOT a bug. This is how C used to work. It bit me once > several years ago. Before the ANSI changes to C the only way to pass > floating point numbers to a routine was as a double (never as a > float). Since you are using the old syntax then when you declare "a" > as a float the compiler will "assume" it is a double since C used to > only pass things as doubles. The old syntax is kept for backward > compatibility. It most certainly IS a bug; you didn't read the assembly code. The compiler thought the location of a was 4 bytes past the location of b, not 8 as it should have been. The code is old, so there was no prototype present anywhere. And yes, I already know how to work around it. By the way, I have already received a reply from a representative of SAS who has provided me with some great support. I have no complaints with the company; all compilers have bugs, even the ones I write... Ross Cunniff Hewlett-Packard Colorado Language Lab cunniff@hpfcla.HP.COM