On Sat, 28 Nov 1998, Hamish Moffatt wrote: > On Sat, Nov 28, 1998 at 09:03:39AM +0100, Ole J. Tetlie wrote: > > It can also be 'int main(void)', which is equivalent to 'main()'. > > Hmmm. I was told that 'int func(void)' means it takes no parameters, > while 'int func()' means it could take any. > > Some example source is below. gcc complains about the call to test2 > (too many arguments) but not to test1.
I think it is the relict from the old C times, when it was not required to provide any function prototypes. The function was assumed to return int value, and all provided arguments were considered to be integers. It was easy to implement because the C stack frame does not require, that the function knows how many arguments are provided - the stack is filled and cleaned up by the caller (In Pascal <at least on x86 uP> the called function is to clean up the stack). Wojtek Zabolotny [EMAIL PROTECTED] > > > #include <stdio.h> > > int test1() > { > printf("test1\n"); > return 0; > } > > int test2(void) > { > printf("test2\n"); > return 0; > } > > int main(void) > { > int i = 3; > > test1(i); > test2(i); > > return 0; > } > > > Hamish > -- > Hamish Moffatt VK3TYD [EMAIL PROTECTED], [EMAIL PROTECTED] > Latest Debian packages at ftp://ftp.rising.com.au/pub/hamish. PGP#EFA6B9D5 > CCs of replies from mailing lists are welcome. http://hamish.home.ml.org > > > -- > Unsubscribe? mail -s unsubscribe [EMAIL PROTECTED] < /dev/null > > >