Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 31 Jan 2002 20:05:49 -0700 (MST)
From:      "M. Warner Losh" <imp@village.org>
To:        tlambert2@mindspring.com
Cc:        drosih@rpi.edu, Todd.Miller@courtesan.com, perry@wasabisystems.com, wes@softweyr.com, asmodai@wxs.nl, mckusick@mckusick.com, arch@FreeBSD.ORG, peter@wemm.org, phk@critter.freebsd.dk, deatley@apple.com, jkh@winston.freebsd.org, deraadt@cvs.openbsd.org
Subject:   Re: __P macro question
Message-ID:  <20020131.200549.85420016.imp@village.org>
In-Reply-To: <3C59FAFA.1EE9B153@mindspring.com>
References:  <p05101402b87f705dd790@[128.113.24.47]> <20020131.153607.63055791.imp@village.org> <3C59FAFA.1EE9B153@mindspring.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In message: <3C59FAFA.1EE9B153@mindspring.com>
            Terry Lambert <tlambert2@mindspring.com> writes:
: "M. Warner Losh" wrote:
: > :   static int  sendfile __P((struct printer *pp, int type, char *file,
: > :                                   int format));
: > :
: > : for a procedure declaration of:
: > :      static int
: > :      sendfile(pp, type, file, format)
: > :              struct printer *pp;
: > :              int type;
: > :              char *file;
: > :              char format;
: > :      {
: > 
: > That's *EXCATLY* why I'm converting the old, but still legal in c89,
: > style to new style.  You get warnings that you didn't get before.
: 
: The compiler is broken, if it accepts the second when the
: first prototype is in scope.
: 
: It's a broken compiler, period.
: 
: Conversion doesn't fix the compiler brokeness.

Fine.  Gcc is broken.  I found at least one case of it in the tree
already. :-)

That's because char is promoted to int when "old style" are used, and
not when new style are used.  At least that's the only explaination I
can think of and I don't care enough to go find the verbage from the
standard that says this.  That's one of the *@#(%&#^% subtle
differences between K&R and ANSI that bite you when you least expect
it.

int foo9(int a); int foo9(a) char a; { }

doesn't produce an error but:

int foo9(int a); int foo9(char a) { }

does.

Warner

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020131.200549.85420016.imp>