Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 31 Jan 2002 22:08:34 -0500
From:      Garance A Drosihn <drosih@rpi.edu>
To:        Terry Lambert <tlambert2@mindspring.com>
Cc:        arch@FreeBSD.ORG, Todd.Miller@courtesan.com, perry@wasabisystems.com
Subject:   Re: __P macro question
Message-ID:  <p0510140ab87fb407b3a4@[128.113.24.47]>
In-Reply-To: <3C59FAFA.1EE9B153@mindspring.com>
References:  <87d6zq31z6.fsf@snark.piermont.com>	 <200201312043.g0VKhrDx004889@xerxes.courtesan.com>	 <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
At 6:18 PM -0800 1/31/02, Terry Lambert wrote:
>  > Garance 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;
>  > :      {
>
>
>The compiler is broken, if it accepts the second when the
>first prototype is in scope.

The gcc compiler is a little funny about this.  It will say nothing
about mismatch of 'int' vs 'char' like the above, but it will warn
if you change it so the mismatch is something like 'int' vs 'float'.

And it will warn about 'int' vs 'char' if you change the routine
declaration to use ANSI-style parameters instead of K&R style.  As
far as I know, the code produced in the non-warning case will work
correctly, but personally I would prefer to get the warning for any
mismatch like this...

-- 
Garance Alistair Drosehn            =   gad@eclipse.acs.rpi.edu
Senior Systems Programmer           or  gad@freebsd.org
Rensselaer Polytechnic Institute    or  drosih@rpi.edu

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?p0510140ab87fb407b3a4>