using floats in functional prototypes

Geoff Rimmer geoff at warwick.UUCP
Wed Feb 1 22:35:00 AEST 1989


In article <11556 at haddock.ima.isc.com> karl at haddock.ima.isc.com (Karl Heuer) writes:
>In article <942 at ubu.warwick.UUCP> geoff at emerald.UUCP (Geoff Rimmer) writes:
>>...  Finally, if you want to do a function prototype for a function with no
>>arguments (e.g. main() in your example), the PROTOTYPE should have 'void'
>>between the parentheses, but the DEFINITION shouldn't:
>
>I see no reason to make such an exception.  If you've got prototypes, use
>them for both declarations and defintions, whether or not the function takes a
>positive number of arguments.  In particular,
>	int main(void) { return 0; }
>is perfectly correct.  The old style (without `void') is obsolescent.

Well I don't know what the dpANS says about this, but I had problems
with QuickC not recognising that I had declared (prototyped) several
functions.  Eventually, I realised this behaviour was only happening
on functions with no params, then by changing for example 

	int main(void)  { ... }
to
	int main() { ... }

it worked fine.  Maybe its a bug in QuickC, but I've seen examples of
writing prototyped functions, and in every case the prototype takes
void, and the definition takes empty parentheses.

>Karl W. Z. Heuer (ima!haddock!karl or karl at haddock.isc.com), The Walking Lint

Geoff

	------------------------------------------------------------
	Geoff Rimmer, Computer Science, Warwick University, England.
			geoff at uk.ac.warwick.emerald

	"Came in? ... Isn't this where we"
		- Pink Floyd, The Wall
	------------------------------------------------------------



More information about the Comp.lang.c mailing list