Xref: utzoo comp.sys.ibm.pc:10048 comp.lang.c:5925 Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!lll-tis!ames!hao!husc6!rutgers!mtune!lzaz!lznv!psc From: psc@lznv.ATT.COM (Paul S. R. Chisholm) Newsgroups: comp.sys.ibm.pc,comp.lang.c Subject: Re: BUG in Turbo C v1.0 float ??? Message-ID: <1241@lznv.ATT.COM> Date: 31 Dec 87 17:32:26 GMT References: <1304@phoenix.Princeton.EDU> Organization: AT&T Lines: 31 Keywords: Turbo C, Bug, float, parameter passing Summary: ancient float/double bug; patched in 1.0, fixed in 1.5 In article <1304@phoenix.Princeton.EDU>, asjoshi@phoenix.Princeton.EDU (Amit S. Joshi) writes: > #include > #define reals float > main() { > reals c; > > c = -3.0; > print_f(c); > } > print_f(c) > reals c;{ > printf("%f\n",c); > } Okay, one last time. There was a problem with functions that took float (not double) arguments in early versions of TC 1.0. The actual argument (in the call) was cast to double, as per K&R, but the formal argument (in the function definition) wasn't. (Or maybe the other way around. Doesn't matter.) No problem if you used doubles, or ANSI/C++ style function prototypes or definitions: print_f( float c) If you have an older copy of 1.0, you can get a patch from Borland. (The patch was on the net, too.) However, this bug is just plain fixed in my real, live, non-beta copy of TC 1.5, which is pretty nice anyway. 1.5 has just about everything 1.0 users asked for (except a debugger:-), and then some. I'll post comments on 1.5 when I have a chance. (Don't hold your breath.) -Paul S. R. Chisholm, {ihnp4,cbosgd,allegra,rutgers}!mtune!lznv!psc AT&T Mail !psrchisholm, Internet psc@lznv.att.com I'm not speaking for my employer, I'm just speaking my mind.