Path: utzoo!attcan!uunet!husc6!rutgers!ucsd!orion.cf.uci.edu!oberon!pollux.usc.edu!papa From: papa@pollux.usc.edu (Marco Papa) Newsgroups: comp.sys.amiga.tech Subject: Re: Prototypes & the default promotions (was about the new RKM stuff.. Message-ID: <15802@oberon.USC.EDU> Date: 12 Mar 89 18:59:05 GMT References: <8903111954.AA04828@jade.berkeley.edu> Sender: news@oberon.USC.EDU Reply-To: papa@pollux.usc.edu (Marco Papa) Organization: Felsina Software, Los Angeles, CA Lines: 47 In article <8903111954.AA04828@jade.berkeley.edu> GIGUERE@WATCSG.BITNET (Eric Giguere) writes: |In article <15751@oberon.USC.EDU|Marco Papa writes: ||Actually things are not as bad as they look, simply because every ||implementation of the 'C' langage has to respect the following rule, ||excerpted from page 186 of K&R: || ||"Any actual argument of type float are converted to double before the call; ||any of type char or short are converted to int;" || ^^^^^ ^^^ | |This is one reason why you shouldn't be using the 1st edition of K&R |anymore as the "final" reference document. With Lattice 5.0 out now |and Manx 5.0 out in a few months, the ANSI standard will be de rigueur. |Let me quote Section 3.3.2.2 of the draft Standard (Dec 7, 1988): | | "If ... the called function ... does not include a prototype, | the integral promotions are performed on each argument and | arguments that have type float are promoted to double." | |but then: | | "If ... the called function ... includes a prototype, the | arguments are implicitly converted, as if by assignment, | to the types of the corresponding parameters." | |So if a prototype is in scope, the default argument promotions are NOT |performed. You're quite right, BUT MANX 5.0 is way way down the line, AND a lot of "current" programs do assume that the argument promotion is performed (which has a lot of implications like sign extension, etc...). As you mention, the ANSI standard ensured that 'old' programs that assumed the "argument promotion" be performed will still behave like K&R, UNLESS function prototypes have been added. MANX 5.0 (as well as Lattice 5.0) library stubs will clearly be different from the current release. The reason I am saying that MANX 5.0 is way down the line is that they are still asking on BIX what "features" programmers would like to see in MANX 5.0 (as you probably know MANX 4.x will not be released). So you should assume that you'll have to work with MANX 3.6 for quite some time. -- Marco Papa 'Doc' -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= uucp:...!pollux!papa BIX:papa ARPAnet:pollux!papa@oberon.usc.edu "There's Alpha, Beta, Gamma and Diga!" -- Leo Schwab [quoting Rick Unland] -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=