Nasty bug
Ray Wallace
wallace at ynotme.enet.dec.com
Fri Aug 31 01:15:38 AEST 1990
In article <0093BF08.7F3834E0 at rigel.efd.lth.se>, e89hse at 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 at oldtmr.enet.dec.com
(UUCP) ...!decwrl!oldtmr.enet!wallace
(INTERNET) wallace%oldtmr.enet at decwrl.dec.com
---
More information about the Comp.lang.c
mailing list