Path: utzoo!attcan!uunet!lll-winken!sun-barr!cs.utexas.edu!news-server.csri.toronto.edu!dgp.toronto.edu!hugh From: hugh@dgp.toronto.edu (D. Hugh Redelmeier) Newsgroups: comp.std.c Subject: Re: Parameter Types in Old-Style Function Definitions Keywords: parameter, function Message-ID: <1990Sep15.011126.23112@jarvis.csri.toronto.edu> Date: 15 Sep 90 05:11:26 GMT References: <10391@pt.cs.cmu.edu> <2689@dataio.Data-IO.COM> <1990Sep8.053408.2005@alphalpha.com> <2700@dataio.Data-IO.COM> Organization: CSRI, University of Toronto Lines: 39 In article <2700@dataio.Data-IO.COM> bright@Data-IO.COM (Walter Bright) writes: >In article <1990Sep8.053408.2005@alphalpha.com> nazgul@alphalpha.com (Kee Hinckley) writes: >< >< foo(c, i) >< char c; >< int i; >< {} >< >< extern foo(char c, int i); >< > >They are *NOT* compatible. The prototype for the first one is: > int foo(int,int); >which is not the same as: > int foo(char,int); >even though some compilers allow this. Actually, Walter is slightly wrong: the default argument promotions on certain implementations may promote char to unsigned int. But he is right in that they cannot leave char as char, so the two declarations are not compatible. The fact that the default argument promotions are implementation dependant is quite unfortunate. This will even cause problems with library functions. For this reason, I think X3J11 should have required that all char values be representable in "int"; if sizeof(char)==sizeof(int), then char should be signed. I said so in a formal comment, but to no avail. Hugh Redelmeier {utcsri, yunexus, uunet!attcan, utzoo, scocan}!redvax!hugh When all else fails: hugh@csri.toronto.edu +1 416 482-8253