Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!henry From: henry@utzoo.UUCP (Henry Spencer) Newsgroups: comp.lang.c Subject: Re: Function prototypes (was: miscellaneous unrelated stuff) Message-ID: <8016@utzoo.UUCP> Date: Mon, 11-May-87 15:24:41 EDT Article-I.D.: utzoo.8016 Posted: Mon May 11 15:24:41 1987 Date-Received: Mon, 11-May-87 15:24:41 EDT References: <18346@ucbvax.BERKELEY.EDU> <7973@utzoo.UUCP>, <796@rtech.UUCP> Organization: U of Toronto Zoology Lines: 29 > > [Function prototypes] have other problems, and I'm not sure they were a > > good idea.... > > This got me curious: what are the problems with function prototypes? The three that immediately come to mind are: 1. Considerable disaster potential when moving code between environments which differ in how they do prototyping. Remember that many (most?) prototypes will be picked up with header files, not explicitly typed by the programmer. What happens when that code gets moved to a system with a non-prototyping compiler? (Such compilers won't go away overnight.) Less drastic and still more subtle, what happens when the code gets moved to a system which doesn't declare quite the same set of functions in the prototypes in its headers? (Don't tell me this shouldn't happen, it will.) 2. Some of the coercions provided by function prototypes are distinctly unsafe, e.g. the shortening ones. Again, prototypes from header files are a nice way to have this happen without the programmer noticing it -- and it's not clear that even lint will complain. 3. They are a significant change to C, implementation experience with them is distinctly limited, and they aren't vitally needed. There is room for debate about whether X3J11 violated the "standardize the existing language, not a new one" rule, and function prototypes are the most conspicuous evidence for violation. -- "The average nutritional value Henry Spencer @ U of Toronto Zoology of promises is roughly zero." {allegra,ihnp4,decvax,pyramid}!utzoo!henry