Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxn!mhuxm!mhuxf!mhuxi!mhuhk!mhuxt!houxm!whuxl!whuxlm!akgua!gatech!seismo!caip!topaz!bentley!kwh From: kwh@bentley.UUCP Newsgroups: net.lang.c Subject: Re: Float Double Parameters Message-ID: <676@bentley.UUCP> Date: Fri, 28-Mar-86 15:17:23 EST Article-I.D.: bentley.676 Posted: Fri Mar 28 15:17:23 1986 Date-Received: Tue, 1-Apr-86 07:11:40 EST References: <2600042@ccvaxa> Organization: AT&T Bell Laboratories, Liberty Corner Lines: 26 In article <2600042@ccvaxa> ccvaxa!aglew writes: >X3J11 says "arguments that have type float are promoted to double". Too bad. I don't know anything about X3J11, but I thought ANSI C would allow the declaration of arguments of extern functions, and would honor "float" if so declared (but would continue to promote float to double for wild-card arguments). >Here is der Mouse's letter... >> foo(r) float r; { ... } My own feeling is that it is WRONG to declare a float argument. Since the language automatically promotes (which I agree is poor design, though I understand the reasons behind it), the variable "r" cannot possibly be a float. The compiler is being "nice" by letting you get away with it (it "knows" that floats can't be passed by value, so it treats it as a double declaration instead). I think it should get a warning at least. Similarly, I never declare a formal parameter as an array (e.g. char *argv[]). It may very well be the name of an array that was passed by the caller, but since it's automatically converted to a pointer, I prefer to declare the formal as a pointer rather than letting the compiler translate the declaration for me. (Also, I could swear I once used a compiler that didn't treat arrays and pointers identically as formal parameters.) Karl W. Z. Heuer (ihnp4!bentley!kwh), The Walking Lint