Date: Mon, 22 Dec 1997 10:19:14 +1030 From: Greg Lehey <grog@lemis.com> To: Joerg Wunsch <joerg_wunsch@uriah.heep.sax.de> Cc: freebsd-current@FreeBSD.ORG Subject: Re: Bruce vandalism again Message-ID: <19971222101914.28785@lemis.com> In-Reply-To: <199712211002.LAA00388@uriah.heep.sax.de>; from J Wunsch on Sun, Dec 21, 1997 at 11:02:36AM %2B0100 References: <199712201434.JAA00329@dyson.iquest.net> <14545.882642903@time.cdrom.com> <19971221120534.43478@lemis.com> <199712211002.LAA00388@uriah.heep.sax.de>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Dec 21, 1997 at 11:02:36AM +0100, J Wunsch wrote: > Greg Lehey <grog@lemis.com> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19971222101914.28785>