🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #1668

Re: Parameter Types in Old-Style Function Definitions

#1668
From: Walter Bright
Date: Mon, 10 Sep 1990 18:30
20 lines
1159 bytes
In article <1990Sep8.053408.2005@alphalpha.com> nazgul@alphalpha.com (Kee Hinckley) writes:
<Consider the following function, defined in K&R:
<
<	foo(c, i)
<	char	c;
<	int	i;
<	{}
<Clearly the function expects to pick two ints up off of the stack.
<
<Now consider the same function, declared and used from ANSI C (or C++).
<	extern foo(char c, int i);
<
<So I guess the question is.  Does the ANSI spec mandate that the above be
<compatible, mandate that they aren't, or not say?

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.
Technical Details
Message-ID: <2700@dataio.Data-IO.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!uunet!pilchuck!dataio!bright
References: <10391@pt.cs.cmu.edu> <2689@dataio.Data-IO.COM> <1990Sep8.053408.2005@alphalpha.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!uunet!pilchuck!dataio!bright
From: bright@Data-IO.COM (Walter Bright)
Newsgroups: comp.std.c
Subject: Re: Parameter Types in Old-Style Function Definitions
Keywords: parameter, function
Message-ID: <2700@dataio.Data-IO.COM>
Date: 10 Sep 90 18:30:11 GMT
References: <10391@pt.cs.cmu.edu> <2689@dataio.Data-IO.COM> <1990Sep8.053408.2005@alphalpha.com>
Organization: Data I/O Corporation; Redmond, WA
Lines: 20