Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!batcomputer!cornell!uw-beaver!milton!ogicse!intelhf!ichips!iwarp.intel.com!inews!pima!bhoughto From: bhoughto@pima.intel.com (Blair P. Houghton) Newsgroups: comp.lang.c Subject: Re: lint (was: Funny mistake) Message-ID: <3433@inews.intel.com> Date: 25 Mar 91 06:16:04 GMT References: <13619@helios.TAMU.EDU> <13627@helios.TAMU.EDU> <5043@goanna.cs.rmit.oz.au> Sender: news@inews.intel.com Organization: Intel Corp, Chandler, AZ Lines: 38 In article <5043@goanna.cs.rmit.oz.au> ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) writes: >In article <13627@helios.TAMU.EDU>, byron@archone.tamu.edu (Byron Rakitzis) writes: >> I am going to write a compiler strongly biased towards ANSI C; if you don't >> supply prototypes, you will pay the price of not having the use of >> unprototyped functions checked for type safety. If you did otherwise, your compiler would be nonconforming. >Ah, I _see_. Only people who are willing to rewrite all their old code >and make it non-portable to pre-ANSI systems (still in very wide use) >will benefit. You know, you _could_ help people who have to maintain >old code by adding to your compiler an option to write prototypes >inferred from the definitions out to a file. Bad attitude, and a little misinformed. An ANSI compiler is required to compile functions and function calls that are declared in the old style; however, it is explicitly stated in the standard that the arguments to a function defined in old-style will not be _checked_, even though passing bogus-typed data can still produce bad results. (see ANSI X3.159-1989, sec. 3.5.4.3, p. 69, ll. 10-11 for one version of it, and sec. 3.5.2.2, p. 42, ll. 17-19 for the actual words "the number and types of arguments are not compared with those of the parameters in a function definition that does not include a function prototype declarator.") You never really did have this sort of type-and-number checking in old compilers, and variadic functions depend on this sort of thing. Some things are still the responsibility of the programmer (or code-generating software, as the case may be). --Blair "It's a feature, not a bug."