Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site sfsup.UUCP Path: utzoo!linus!decvax!bellcore!ulysses!mhuxr!mhuxn!mhuxm!sftig!sfsup!mjs From: mjs@sfsup.UUCP (M.J.Shannon) Newsgroups: net.lang.c Subject: Re: Float Double Parameters Message-ID: <198@sfsup.UUCP> Date: Tue, 1-Apr-86 23:54:30 EST Article-I.D.: sfsup.198 Posted: Tue Apr 1 23:54:30 1986 Date-Received: Sat, 5-Apr-86 06:49:14 EST References: <2600042@ccvaxa> <5216@alice.uUCp> <2442@utcsri.UUCP> Organization: AT&T Information Systems, Summit N.J. Lines: 56 > In article <5216@alice.uUCp> ark@alice.UucP (Andrew Koenig) writes: > >>X3J11 says "arguments that have type float are promoted to double". Too bad. > > > >Ansi C also lets you declare types of formal parameters to externals: > > > > extern float f(float x); > >in which case: > > f(1); /* 1 is converted to float */ > > f(1.0); /* 1.0 is converted to float */ > > > >are both OK. > > OK, but doesn't "extern float f(float x)" really mean > "extern float f( double x )"? No. It really means what it says! > I.e. '1' and '1.0' are passed as doubles to > f in the above examples. I don't know, but I suppose this feature has been > added only to allow the compiler to check ( and convert when applicable ) the > parameter types. Wrong. The actual parameters (1 and 1.0) above are converted to float. > If the above *is* correct, then apparently I can pass a float to a function > ( provided it is not defined in the current file (!?!?!?!) ) but it is *not* > possible to write a function that accepts a float as a parameter. The following function accepts a float as a parameter: void f(float x) { return; } > C is strange, but not that strange - I suspect Mr. Koenig has read something > into the standard that is not there. If anyone has reliable information > to the contrary, let us know... Please read the latest (or any recent) draft from ANSI. Please do not speculate on subjects you don't know anything about. Ask questions, but please don't advance your speculations as facts. > "If you aren't making any mistakes, you aren't doing anything". You are doing *something*. > Greg Smith University of Toronto UUCP: ..utzoo!utcsri!greg -- Marty Shannon UUCP: ihnp4!attunix!mjs Phone: +1 (201) 522 6063 Disclaimer: I speak for no one. "If I never loved, I never would have cried." -- Simon & Garfunkel