lint (was: Funny mistake)
Blair P. Houghton
bhoughto at pima.intel.com
Mon Mar 25 16:16:04 AEST 1991
In article <5043 at goanna.cs.rmit.oz.au> ok at goanna.cs.rmit.oz.au (Richard A. O'Keefe) writes:
>In article <13627 at helios.TAMU.EDU>, byron at 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."
More information about the Comp.lang.c
mailing list