From owner-freebsd-hackers Fri Apr 14 23:58:40 1995 Return-Path: hackers-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id XAA01896 for hackers-outgoing; Fri, 14 Apr 1995 23:58:40 -0700 Received: from irz301.inf.tu-dresden.de (irz301.inf.tu-dresden.de [141.76.1.11]) by freefall.cdrom.com (8.6.10/8.6.6) with SMTP id XAA01872 for ; Fri, 14 Apr 1995 23:58:31 -0700 Received: from sax.sax.de by irz301.inf.tu-dresden.de with SMTP (5.67b+/DEC-Ultrix/4.3) id AA24908; Sat, 15 Apr 1995 08:58:26 +0200 Received: by sax.sax.de (8.6.12/8.6.12-s1) with UUCP id IAA02757 for freebsd-hackers@freebsd.org; Sat, 15 Apr 1995 08:58:24 +0200 Received: (from j@localhost) by uriah.heep.sax.de (8.6.11/8.6.9) id IAA01712 for freebsd-hackers@freebsd.org; Sat, 15 Apr 1995 08:24:19 +0200 From: J Wunsch Message-Id: <199504150624.IAA01712@uriah.heep.sax.de> Subject: Re: 90's compilers To: freebsd-hackers@FreeBSD.org (FreeBSD hackers) Date: Sat, 15 Apr 1995 08:24:18 +0200 (MET DST) In-Reply-To: <199504142309.TAA03606@hda.com> from "Peter Dufault" at Apr 14, 95 07:09:26 pm Reply-To: joerg_wunsch@uriah.heep.sax.de (Joerg Wunsch) X-Phone: +49-351-2012 669 X-Mailer: ELM [version 2.4 PL23] Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Content-Length: 1945 Sender: hackers-owner@FreeBSD.org Precedence: bulk As Peter Dufault wrote: > > If you're proposing changing the coding guidelines away from KNF > on this I'm all for it. There has never been an `official' coding guideline to keep KNF. In fact, some device drivers under i386/isa do already fully use `new' style. The boot code has been crying for a revamp. The writers didn't even bother to declare external functions at all (``all the world is an int, and might take any possible number of arguments'' :). There have been many errors in the code (functions that actually take a `char' argument, while the compiler promoted it to `int' -- works only since we're little-endian). This style made it highly error-prone. ANSI-style function declaration seems to be much more rationale, and if done consistently from hour 0 of some new portion of code, it ain't more work. But it's not only function declarations, consider the following piece of code: - /* This is ugly, but why use 4 printf()s when 1 will do? */ - printf("\n\ ->> FreeBSD BOOT @ 0x%x: %d/%d k of memory\n\ -Use hd(1,a)/kernel to boot sd0 when wd0 is also installed.\n\ -Usage: [[%s(%d,a)]%s][-abcdhrsv]\n\ -Use ? for file list or press Enter for defaults\n\n", + printf("\n>> FreeBSD BOOT @ 0x%x: %d/%d k of memory\n" + "Use hd(1,a)/kernel to boot sd0 when wd0 is also installed.\n" + "Usage: [[%s(%d,a)]%s][-abcdhrsv]\n" + "Use ? for file list or press Enter for defaults\n\n", Why use the ugly style (and document it to be ugly) if we can do it better? > I can't imagine what we would ever port to that wouldn't have a > decent compiler - I wouldn't choose a microcontroller compiler that > didn't support Standard C. Our only non-ANSI-conforming compiler by now is bcc. It's scope is limited to few areas, however. -- cheers, J"org joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ Never trust an operating system you don't have sources for. ;-)