Nude Vicar in Sex Romp!

Bob Devine devine at shodha.dec.com
Tue Aug 22 03:14:38 AEST 1989


In article <960 at prlhp1.prl.philips.co.uk>, yuleat at prlhp1.prl.philips.co.uk (yuleat) writes:
> fn2(x, y)
> float *x, *y;
>  {
>     printf("In fn2 values are x= %f & y= %f\n", *x, *y);
>  }
> 
> What I would like to know is whether this is what the compiler
> should do (I've looked in K&R and I couldn't find anything
> that addressed this problem specifically).

  Check out the sections on parameter widening.  The floats (likely
these are 4 bytes) are being widened to doubles (8 bytes) so when
you use a `float *' you are only getting 1/2 the number.  On some
machines a hardware check for a valid floating point number is made
so if you had bad luck to select the wrong bit pattern the program
would have dumped with a very misleading error!

Bob Devine



More information about the Comp.lang.c mailing list