From owner-freebsd-arch Fri Feb 1 8:21:46 2002 Delivered-To: freebsd-arch@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id 0977937B405 for ; Fri, 1 Feb 2002 08:21:41 -0800 (PST) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id DAA20950; Sat, 2 Feb 2002 03:20:48 +1100 Date: Sat, 2 Feb 2002 03:22:55 +1100 (EST) From: Bruce Evans X-X-Sender: To: Mark Murray Cc: Juha Juntunen , Subject: Re: __P macro question In-Reply-To: <200202011438.g11EbxE98677@greenpeace.grondar.org> Message-ID: <20020202031144.N3615-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Fri, 1 Feb 2002, Mark Murray wrote: > > ... > > People removing __P should also be familiar with the gcc conterpoint: > > > > void foo(char); /* Wrong; should be "void foo(int);". */ > > void foo(c) char c; {} > > > > gives undefined behaviour in Standard C, but gcc defines its behaviour > > to be do-what-naive-programmer-expects. This is only safe provided the > > wrong prototype for foo() is always in scope before foo() is called; > > otherwise foo() is sometimes passed an int and sometimes a char, but > > foo() expects to be passed either an int or a char depending on whether > > the wrong prototype is in scope for the function body. > > So, does this not effectively make a rule, "You will _always_ properly > prototype functions, and make sure that these proper prototypes are in > scope before you use (and define) the functions."? Not quite. You can use lint to find arg mismatches. Even the 90%-finished lint in FreeBSD is effective compared with unavailable link-time checkers. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message