Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!sun-barr!texsun!csccat!larry From: larry@csccat.UUCP (Larry Spence) Newsgroups: comp.windows.ms Subject: Re: FAR functions and float types Message-ID: <3304@csccat.UUCP> Date: 12 Sep 89 22:47:56 GMT References: <246400022@uxa.cso.uiuc.edu> Reply-To: larry@csccat.UUCP (Larry Spence) Organization: Computer Support Corporation. Dallas,Texas Lines: 31 In article <246400022@uxa.cso.uiuc.edu> mms00786@uxa.cso.uiuc.edu writes: >Here's what happens: > >a) if I declare something like > void FAR fnPlotSegment (hWnd, fFromX, fToX) > HWND hWnd; > float fFromX; > float fToX; > {...} > then I am unable to pass the float type arguments! Everything compiles, runs, > etc. but if I try to print the float values passed in, they are always 0.0! I believe that there is a documented bug in LINK4 (?) that screws up floats passed to functions. You'll have to either use pointers to floats, which you may have to make static, or doubles. The former is usually preferable. >I am also having incredible problems trying to pass user defined types as >arguments to functions - as in just can't do it. I used to have a lot of problems with this. For example, passing a param of type COMPLEX, where COMPLEX is a struct with the real and imaginary parts, caused all kinds of bizarre behavior. The best thing to do is to pass a pointer instead, since the code generated is pretty simple in that case. Note that the likelihood and severity of these problems varies slightly from 4.X to 5.X. Larry Spence larry@csccat ...{texbell,texsun,attctc}!csccat!larry "Fatal Exit Code 0x0001! Ack!"