Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!ukma!uflorida!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn ) Newsgroups: comp.lang.c Subject: Re: function prototype problem Message-ID: <8916@smoke.BRL.MIL> Date: 18 Nov 88 02:53:19 GMT References: <310@drd.UUCP> <1704@scolex> <8889@smoke.BRL.MIL> <1736@scolex> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Distribution: na Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 13 In article <1736@scolex> seanf@sco.COM (Sean Fagan) writes: >So, the moral of the story: Don't pass in char's, short's, or float's to >your subroutines unless you want a Real(tm) ANSI C compiler to choke on it No, that's the wrong moral. The correct conclusion is that prototypes for old-style-defined functions must declare the parameters with the correctly widened types. In other words, when converting to prototypes either convert EVERY reference to a function AND its definition to use compatible prototypes (in which case any appropriate argument type can be declared), or else use only widened parameter types. For example, extern double sin(float); is wrong because for reasons of compatibility the parameter must be of type double by the time it reaches the innards of the function.