Xref: utzoo comp.lang.c:15951 comp.sys.ibm.pc:24090 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!nrl-cmf!ames!amdcad!sun!pitstop!sundc!seismo!uunet!mcvax!ukc!warwick!geoff From: geoff@warwick.UUCP (Geoff Rimmer) Newsgroups: comp.lang.c,comp.sys.ibm.pc Subject: Re: using floats in functional prototypes Message-ID: <992@ubu.warwick.UUCP> Date: 1 Feb 89 12:35:00 GMT References: <1989Jan18.092522.14499@gpu.utcs.toronto.edu> <942@ubu.warwick.UUCP> <11556@haddock.ima.isc.com> Sender: news@warwick.UUCP Reply-To: geoff@emerald.UUCP (Geoff Rimmer) Organization: Computer Science, Warwick University, UK Lines: 36 In article <11556@haddock.ima.isc.com> karl@haddock.ima.isc.com (Karl Heuer) writes: >In article <942@ubu.warwick.UUCP> geoff@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@haddock.isc.com), The Walking Lint Geoff ------------------------------------------------------------ Geoff Rimmer, Computer Science, Warwick University, England. geoff@uk.ac.warwick.emerald "Came in? ... Isn't this where we" - Pink Floyd, The Wall ------------------------------------------------------------