Syntax of function prototypes...

Michael Burgett burgett at steel.COM
Fri Aug 19 23:50:07 AEST 1988


In article <871 at buengc.BU.EDU> bph at buengc.bu.edu (Blair P. Houghton) writes:
>>
>>definition          int something(int a, float b, char c)
>>
>>possible prototypes
>>	  int something(int a, float b, char c);
>>          int something(int n, float x, char c1);
>>          int something(int, float, char);
>
>Am I missing something (there _is_ an echo in here; I should have
>"am I missing something" mapped to the spacebar...:-) or is
>
>int something();
>
>just as good (for a prototype) (except for the obviously better style
>of the above, since they are virtually self-commenting)?
>
yes you're missing something.  By function prototyping you have to declare the
type and number (or indicate that there is a variable number) of parameters
so that the compiler can play lint and check all usage of the function calls
throughout your code.  What you list indicates that "something" is a function
returning an int, but nothing else.  If this is used with ANSI I believe the 
compiler will look at the first time you use a function to determine the 
arguments...

		mike burgett

				burgett!adobe at decwrl.dec.com



More information about the Comp.lang.c mailing list