parameter adjustment (was double indirection)

Chris Torek chris at trantor.umd.edu
Wed Feb 17 00:08:00 AEST 1988


In article <16940 at watmath.waterloo.edu> rbutterworth at watmath.waterloo.edu
(Ray Butterworth) writes:
>C performs this "helpful" adjustment of the programmer's
>misdeclaration with other parameters too. ...
>sizeof args:   float=8  double=8  short=2  char=1  int[10]=4
>sizeof autos:  float=4  double=8  short=2  char=1  int[10]=40
>
>The "40" vs. the "4" shows the array parameter "adjustment".

This one is `correct' according to the language definition;

>And (float) is similarly adjusted form 4 to 8, since it is
>actually passed as (double).

but this one is just a bug.

Vax PCC could get away without the internal adjustment, since the Vax's
float and double (F and D floating, not G and H) types are `compatible'.
That is, double just adds more mantissa bits.  Other compilers might
have to generate a `virtual local float', something like:

	f(x) float x; { ... }
becomes: f(_arg_x) double _arg_x; { float x = _arg_x; ... }
-- 
In-Real-Life: Chris Torek, Univ of MD Computer Science, +1 301 454 7163
(hiding out on trantor.umd.edu until mimsy is reassembled in its new home)
Domain: chris at mimsy.umd.edu		Path: not easily reachable



More information about the Comp.lang.c mailing list