Path: utzoo!utgpu!water!watmath!clyde!bellcore!decvax!purdue!umd5!trantor.umd.edu!chris From: chris@trantor.umd.edu (Chris Torek) Newsgroups: comp.lang.c Subject: Re: parameter adjustment (was double indirection) Message-ID: <2305@umd5.umd.edu> Date: 16 Feb 88 14:08:00 GMT References: <4292@rosevax.Rosemount.COM> <2292@umd5.umd.edu> <16940@watmath.waterloo.edu> Sender: ris@umd5.umd.edu Reply-To: chris@trantor.umd.edu (Chris Torek) Organization: University of Maryland, College Park Lines: 27 In article <16940@watmath.waterloo.edu> rbutterworth@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@mimsy.umd.edu Path: not easily reachable