From owner-freebsd-current Sun Dec 21 15:53:48 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id PAA07058 for current-outgoing; Sun, 21 Dec 1997 15:53:48 -0800 (PST) (envelope-from owner-freebsd-current) Received: from freebie.lemis.com (gregl1.lnk.telstra.net [139.130.136.133]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id PAA06812 for ; Sun, 21 Dec 1997 15:49:43 -0800 (PST) (envelope-from grog@lemis.com) Received: (from grog@localhost) by freebie.lemis.com (8.8.8/8.8.7) id KAA03084; Mon, 22 Dec 1997 10:19:14 +1030 (CST) (envelope-from grog) Message-ID: <19971222101914.28785@lemis.com> Date: Mon, 22 Dec 1997 10:19:14 +1030 From: Greg Lehey To: Joerg Wunsch Cc: freebsd-current@FreeBSD.ORG Subject: Re: Bruce vandalism again References: <199712201434.JAA00329@dyson.iquest.net> <14545.882642903@time.cdrom.com> <19971221120534.43478@lemis.com> <199712211002.LAA00388@uriah.heep.sax.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.88e In-Reply-To: <199712211002.LAA00388@uriah.heep.sax.de>; from J Wunsch on Sun, Dec 21, 1997 at 11:02:36AM +0100 Organisation: LEMIS, PO Box 460, Echunga SA 5153, Australia Phone: +61-8-8388-8286 Fax: +61-8-8388-8725 Mobile: +61-41-739-7062 WWW-Home-Page: http://www.lemis.com/~grog Sender: owner-freebsd-current@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk On Sun, Dec 21, 1997 at 11:02:36AM +0100, J Wunsch wrote: > Greg Lehey wrote: > >> But the question of consistency brings with it the question >> of what kind of consistency. > > Self-consistency, inside one file. So far, so good. But the question of consistency brings with it the question of what kind of consistency. Specifically, do we want to advance or retreat? >> Since ANSI C prototypes enable more error checking than (voluntary) >> K&R prototypes, I consider them a Good Thing. > Old-style function declarations weren't called `prototype'. Correct. I was talking explicitly about ANSI prototypes. >> int ether_ioctl __P((struct ifnet *, int, caddr_t)); >> >> It's a lot easier to prove consistency if the declaration and >> definition use the same kind of prototype. > > Definitions aren't called prototypes either. No, but they can contain them, and that's what I'm advocating. > It's quite normal that if your definition is old-style, the > declaration would still be prototyped on a compiler that defines > __STDC__ (via __P()). If the programmer does the Right Thing. My understanding was that style(9) discourages __P(). > At least, potential `consumers' of the declaration (those who > include the .h file) will see the proper prototype, so they benefit > from the typechecking nevertheless, even though the definition is > old-style. I think gcc even warns some (all?) possible problems iff > the old-style definition is inconsistent with the ANSI prototype > (from the .h file). There are some warnings, but they're not as good as they could be if the function definition included a correct prototype. >> About the only plausible argument I've seen in favour of the K&R style >> is (from Bruce) that it makes importing 4.4BSD Lite 2 easier. > > The main point is that it makes it easier to find the functional > differences when cvs diffing against the vendor branches, or when > diffing the files against the Net/OpenBSD versions. Well, OK, yes, that's the same sort of thing. It's not really programming one way or the other. > We'll need some policy decision that makes it clear when it's OK to > move an entire file to ANSI declarations. Good idea. > Mixed declaration styles inside the same file have never been > encouraged. No debate about that. Greg