Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!zaphod.mps.ohio-state.edu!wuarchive!udel!haven!decuac!shlump.nac.dec.com!engage.enet.dec.com!ynotme.enet.dec.com!wallace From: wallace@ynotme.enet.dec.com (Ray Wallace) Newsgroups: comp.lang.c Subject: Re: Nasty bug Message-ID: <2020@engage.enet.dec.com> Date: 30 Aug 90 15:15:38 GMT Sender: news@engage.enet.dec.com Organization: Digital Equipment Corporation Lines: 23 In article <0093BF08.7F3834E0@rigel.efd.lth.se>, e89hse@rigel.efd.lth.se writes... > I had a lot of trouble with a bug yesterday. The code was similar to the >following: >And it didn't work. Why? The answer is that the parameter f is a >double, not a float since all floats are converted to double when they are >passed as arguments to functions. Therefore &f is a ptr to double rather than a >ptr to float as one would expect looking at the declartion. Sounds like a compiler bug to me. Floats are promoted to double in a procedure call but since your procedure declared the parameter as a float the compiler should have "demoted" the parameter so that &variable would work properly. FYI: Your code fragment worked properly with the VAX VMS-C compiler. --- Ray Wallace (INTERNET,UUCP) wallace@oldtmr.enet.dec.com (UUCP) ...!decwrl!oldtmr.enet!wallace (INTERNET) wallace%oldtmr.enet@decwrl.dec.com ---