Newsgroups: comp.lang.c Path: utzoo!henry From: henry@zoo.toronto.edu (Henry Spencer) Subject: Re: Prototypes Message-ID: <1990Jul7.235850.7603@zoo.toronto.edu> Organization: U of Toronto Zoology References: <55550@lanl.gov> Date: Sat, 7 Jul 90 23:58:50 GMT In article <55550@lanl.gov> rdw2030@venus.tamu.edu writes: >... I've never understood why they exist! Programs run without them! >My question... why prototypes? ... They make it possible for the compiler to do type checking that formerly had to be done by the programmer or lint (both error-prone, the former because of human frailty and the latter because too many people either don't have it or won't use it). They also give the compiler more information about how functions are called, which permits optimized calling sequences of various kinds. Notably, it is no longer necessary for the compiler to assume that any function might be a varargs function, so non-varargs calls need not be constrained by the tricky requirements of varargs. Also of note for the numerical community is the ability to pass floats as floats and not have them widened to double, which can be costly. -- "Either NFS must be scrapped or NFS | Henry Spencer at U of Toronto Zoology must be changed." -John K. Ousterhout | henry@zoo.toronto.edu utzoo!henry