Date: Thu, 13 Aug 1998 13:09:45 +0200 From: Hans-Bernhard Broeker Message-Id: <199808131109.NAA15641@acp3bf.physik.rwth-aachen.de> To: merlin__ AT geocities DOT com (Merlin) Cc: djgpp AT delorie DOT com Subject: Re: A very basic question about C programming... diary of a newbie Part 1 Newsgroups: comp.os.msdos.djgpp Organization: RWTH Aachen, III. physikalisches Institut B Precedence: bulk In article <35D2A017 DOT 4808178C AT geocities DOT com> you wrote: > Eli Zaretskii wrote: > > On Wed, 12 Aug 1998, Merlin wrote: > > > > > void do_nothing(); //these are prototypes > > > > No, this isn't a prototype. This is: > > > > void do_nothing(void); > if you leave the void in brackets out it will be assumed.. Wrong. In C, leaving out the argument list completely means you just wrote an 'old-style' (i.e.: K&R) function declaration, not a prototype. In detail, it does *not* define the function to take no arguments at all, it simply doesn't tell anything about the arguments. That means: void do_nothing(); int main(void) { do_nothing(235); return 0; } void do_nothing(foo) int foo; { foo = foo + foo; } is a valid, correct ANSI-C program. It compiles, links and even works without any problem or warning message with 'gcc -ansi -pedantic -Wall -W -g -O'. Change the first line to 'void do_nothing(void);', and gcc won't even compile it any longer. C++ is a different case: there '()' means '(void)', which itself is *illegal*. At least, that's what my lossy memory tells me. -- Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de) Even if all the snow were burnt, ashes would remain.