IRIX 3.2 C compiler bug (Mark Gets Pie in the Face)
Robert Adsett
semicon at watsci.uwaterloo.ca
Tue Feb 6 11:39:46 AEST 1990
In article <13600 at phoenix.Princeton.EDU> markv at gauss.Princeton.EDU (Mark VandeWettering) writes:
>In article <12999 at cgl.ucsf.EDU> conrad at cgl.ucsf.edu (Conrad Huang) writes:
>>
>>In the second place, even if they were equal, it should print 1.000000.
>
>Actually, if we wanna get really technical about it, this program shouldn't
>work at all, because you passed a double to the printf, when in fact it
>wants a float argument. This usually works out, but I have had it fail
>on various machines (particularly mips based ones) in very odd ways, so
>one should be careful.
No, floats get expanded to doubles when they are passed. Printf expects
to receive a double. If this fails on some machines then either their
compiler or library is broken. In ANSI C when a prototype indicates a
float parmaeter then there is no implicit conversion.
--
Robert Adsett <semicon at watsci.UWaterloo.ca>
Dept. of Phys, Univ. of Waterloo, Waterloo Ont. Canada
More information about the Comp.sys.sgi
mailing list