Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!ucsd!ucbvax!KARRON.MED.NYU.EDU!karron From: karron@KARRON.MED.NYU.EDU Newsgroups: comp.sys.sgi Subject: Re: Mixing ANSI and K & R 1 code. Message-ID: <9011171557.AA16135@karron.med.nyu.edu> Date: 17 Nov 90 15:57:39 GMT Sender: daemon@ucbvax.BERKELEY.EDU Reply-To: karron%CMCL2.NYU.EDU@cunyvm.cuny.edu Organization: The Internet Lines: 52 >>Seems you can't have newstyle argument lists (ANSI) receiving parameters >>from old styles,non prototyped code. >> >>I first tried to write all my new stuff in ANSI code, but it would >>always get float (Coord) arguments wrong. > >... > >>This is something that should be fixed. > >Fine, hop in your time machine, go back to the ANSI C meetings where >they decided that if you have a routine declared with prototypes with >arguments that are "float", that it really gets passed "float"s, not >"double"s, and convince them otherwise. That should fix it.... > >If that's not possible, you're out of luck unless you can convince SGI >or whoever to have "float" just mean "double", which is unlikely given >the number of other things it'll probably break.... > >If you have a routine that is to have prototypes, is to be passed >floating-point arguments, and is to be called by old-style C, make its >arguments "double" - even if that means not giving them type "Coord". > Sgi has make a weak attempt to address this "standard" problem. There is a cc -float flag to stop default promotion to doubles in argument/parameter lists. Just seems not to work they way I hoped in spliced code... I am not finished testing this out, so if anyone has any more insight, I would like for you to speak up. My design goal is to mix a library of K & R 1 code with ANSI C, and when the K & R stuff is upgraded, not change my ANSI C code. I guess that there is no performance penalty for passing by value floats as doubles, but I am not certain of it. It is more bytes to push to the stack. Another suggested solution is to make ANSI headers for K & R 1 code. This is a slippery issue and I am not certain about a robust answer. At least the run time code really breaks when the problem arises ! (Only with floats). Cheers! dan. +-----------------------------------------------------------------------------+ | karron@nyu.edu (mail alias that will always find me) | | Dan Karron | | . . . . . . . . . . . . . . New York University Medical Center | | 560 First Avenue \ \ Pager <1> (212) 397 9330 | | New York, New York 10016 \**\ <2> 10896 <3> | | (212) 340 5210 \**\__________________________________________ | | Please Note : Soon to move to dan@karron.med.nyu.edu 128.122.135.3 (Nov 1 )| +-----------------------------------------------------------------------------+