Path: utzoo!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!nosc!ucsd!orion!ics.uci.edu!nagel From: nagel@ics.uci.edu (Mark Nagel) Newsgroups: comp.lang.c Subject: Curious about function prototypes... Message-ID: <654@orion.cf.uci.edu> Date: 10 Jun 88 16:50:34 GMT Sender: news@orion.cf.uci.edu Reply-To: nagel@ics.uci.edu (Mark Nagel) Organization: University of California, Irvine - Dept. of ICS Lines: 29 I have been using function prototypes a bit in LightspeedC for the Macintosh and I was under the impression that the following was a correct prototype: char *foo(char *c, int i); for the function: char *foo(c, i) char *c; int i; { /* function body */ } A friend of mine who is installing the GNU C compiler here tells me that the ANSI standard has changed this so that the function body header must look like the function prototype. The GNU documentation says that something like the above is now an error. While I don't mind altering my habits to adapt to the new way (if this is really the case), I am curious as to why this change was adopted. It seems to me that prototypes were designed such that modules compiled separately would be able to determine the proper arguments without access to the actual source of the other module(s). What added benefit does forcing duplication of the function prototype offer? Or have we misunderstood the GNU documentation? I've read this group for quite a while and I thought I would have heard about so drastic a change, but perhaps I missed it. Mark D. Nagel Department of Information and Computer Science, UC Irvine nagel@ics.uci.edu (ARPA) I'm not a graduate student, {sdcsvax|ucbvax}!ucivax!nagel (UUCP) but I play one on TV...