Xref: utzoo comp.lang.c:15648 comp.sys.ibm.pc:23479 Path: utzoo!attcan!uunet!sdrc!scjones From: scjones@sdrc.UUCP (Larry Jones) Newsgroups: comp.lang.c,comp.sys.ibm.pc Subject: Re: using floats in functional prototypes Summary: old-style definitions take widened args Keywords: float, MS-C 5.1, QC, Turbo C, Help Please! Message-ID: <508@sdrc.UUCP> Date: 19 Jan 89 22:36:24 GMT References: <1989Jan18.092522.14499@gpu.utcs.toronto.edu> Organization: Structural Dynamics Research Corp., Cincinnati Lines: 31 In article <1989Jan18.092522.14499@gpu.utcs.toronto.edu>, romwa@gpu.utcs.toronto.edu (Royal Ontario Museum) writes: > When I compile the two files, I get a warning that the type of > the argument in the prototype doesn't match the declaration > > void afunc( float ); > > void afunc( flt_val ) > float flt_val; > { > int i; > > i = 3; > } The problem is that you have witten the function definition using the old-style syntax. When you do that, the function expects to be called with widened arguments (i.e. the float argument will actually be passed as a double). To fix the problem, either change the float in the prototype to double or write the definition using prototype form: void afunc( float flt_val ) { } ---- Larry Jones UUCP: uunet!sdrc!scjones SDRC scjones@sdrc.UU.NET 2000 Eastman Dr. BIX: ltl Milford, OH 45150 AT&T: (513) 576-2070 "When all else fails, read the directions."