[2533] in Kerberos_V5_Development

home help back first fref pref prev next nref lref last post

Re: Prototype hell

daemon@ATHENA.MIT.EDU (Tom Yu)
Thu Oct 9 17:58:06 1997

Date: Thu, 9 Oct 1997 17:57:26 -0400
To: Jeffrey Hutzelman <jhutz+@cmu.edu>
Cc: Ken Hornstein <kenh@cmf.nrl.navy.mil>, krbdev@MIT.EDU
From: Tom Yu <tlyu@MIT.EDU>
In-Reply-To: <ML-2.3+1.876431011.4803.jhutz@minbar.fac.cs.cmu.edu>

The following should *not* give an error with an ANSI compliant
compiler:

int foo(int a, short b, char c);

int foo(a, b, c)
	int a;
	short b;
	char c;
{
	/* ... */
}

6.7.1 says: "If the declarator includes an identifier list, the types
of the parameters may be declared in a following declaration list.
Any parameter that is not declared has type |int|."

Likewise, type promotion only occurs during calls to functions having
no argument type information in the prototype, or lack a prototype
altogether.

6.3.2.2 says: "If the expression that denotes the called function has
a types that does not include a prototype, the integral promotions are
performed on each argument..."

So basically, Ken's problem is either a compiler bug (does the problem
occur with gcc?), or an actual code bug that results from failing to
declare the type of a argument in the definition of the function.

Nevermind that krb5_int32 should probably mean "integral type
containing at least 32 bits" and by default be typedefed to a long....

---Tom

home help back first fref pref prev next nref lref last post