Newsgroups: comp.lang.c
Path: utzoo!henry
From: henry@zoo.toronto.edu (Henry Spencer)
Subject: Re: Func Protos with K&R Func Defs
Message-ID: <1991Feb28.173517.18083@zoo.toronto.edu>
Organization: U of Toronto Zoology
References: <11614@jpl-devvax.JPL.NASA.GOV> <1991Feb28.021715.18153@athena.mit.edu>
Date: Thu, 28 Feb 1991 17:35:17 GMT

In article <1991Feb28.021715.18153@athena.mit.edu> jik@athena.mit.edu (Jonathan I. Kamens) writes:
>  In ANSI C, a function declaration must match its definition.  That means
>that if the declaration is prototyped, then the definition must also be
>prototyped, with the same types; if the declaration is not prototyped, then
>the definition cannot be prototyped either.

Not so.  The types of declaration and definition must match, after some
complicated considerations of default argument promotions etc. are taken
into account.  But there is no requirement that use and definition match
in the sense of using prototypes.  It is quite permissible to provide
a prototype for an old-style function or use a new-style definition for 
an unprototyped function.  You just have to know what you are doing; it
is not quite as easy as it looks.  The example Jonathan gives is indeed
illegal, but it's simple to fix it.
-- 
"But this *is* the simplified version   | Henry Spencer @ U of Toronto Zoology
for the general public."     -S. Harris |  henry@zoo.toronto.edu  utzoo!henry
