[1072] in Kerberos-V5-bugs

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

Declaration of asn1buf_insert_octet(buf, o)

daemon@ATHENA.MIT.EDU (Ezra Peisach)
Sun Feb 5 09:34:04 1995

To: krb5-bugs@MIT.EDU
Date: Sun, 05 Feb 1995 09:33:54 EST
From: Ezra Peisach <epeisach@MIT.EDU>


In asn1buf.c:

asn1_error_code asn1buf_insert_octet(buf, o)
     asn1buf * buf;
     const asn1_octet o;

but in asn1buf.h:
asn1_error_code asn1buf_insert_octet
	PROTOTYPE((asn1buf *buf, const /*asn1_octet*/int o));

trying to compile with the standard c option enabled under OSF/1
complains of prototype error (which is correct). 

For some reason, the compiler gets upset because of the new style and
old style declaration with a char type being declared...

For instance:

- -----------------------------------------
int foo(char);

foo(o)
char o;
{
	printf("%d\n", o);
}

has the following error:
/usr/lib/cmplrs/cc/cfe: Warning: /tmp/a.c, line 6: prototype declaration and non-prototype definition found for foo, the type of this parameter is not compatible with the type after applying default argument promotion (3.5.4.3(15))
 char o;
 -----^

- ------------------------------------------------
The following however is fine:

int foo(char);

foo(char o)
{
	printf("%d\n", o);
}

Of course gcc is happy in both cases....

(The error is with the native cc compiler with OSFv1.3 and occurs with
v3.0 as well)...

I suspect this is a case of narrow vs. wide declaratons... Perhaps a
wide definition is called for in asn1base.c to be consistant with the
prototype?

	Ezra




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