Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!pilchuck!amc-gw!sigma!flash!bill From: bill@flash.UUCP (William Swan) Newsgroups: comp.os.minix Subject: Re: float VS double: The return... Message-ID: <643@flash.UUCP> Date: 11 Apr 90 21:38:03 GMT References: <16383@nigel.udel.EDU> Reply-To: bill@flash.UUCP (William Swan) Organization: The Baidarka Historical Society Lines: 43 In article <16383@nigel.udel.EDU> ARCHER@segin4.segin.fr writes: >CvW> ... WHAT ABOUT >CvW> test(a) float a; >CvW> { >CvW> test1(&a); >CvW> } >CvW> This certainly passes a pointer to a double, and this can't be changed. >CvW> So I ask the C Syntax experts - what do you think a compiler should do >CvW> in both cases? I've come a little late into this discussion, and I'm no C Syntax Expert[tm], but I've run into this before. Oddly, this came up on a local BBS this past weekend. The description of the ANSI C standard in K&R 2nd Ed. says, in essence, that float parameters declared "old-style" are promoted to double, those declared "new-style" are not. (K&R C, 2nd Ed. ,p 202, section A7.3.2 Function Calls) In other words: main() { float f; test(&f); } test(f) float *pf; { printf(..., *pf); } will fail, but: main() { float f; test(&f); } test(float *pf) { printf(..., *pf); } will not. -- Bill Swan bill@Summation.WA.COM Send postal address for info: Innocent but in prison in Washington State for 13.5 years (or more): Ms. Debbie Runyan: incarcerated 01/1989, scheduled release 07/2002. In now: 1 year, 2 months, 3 weeks, 1 day.