From: "Michael W. Ryder" <_mwryder@...> Date: 2007-05-08T08:30:16+09:00 Subject: Re: rdoc on c and cpp files John Joyce wrote: > > On May 8, 2007, at 7:51 AM, Peter Seebach wrote: > >> In message <923DE35C-CA19-4867-B3CE-FC3DB60A4393@gmail.com>, John >> Joyce writes: >>> What PS is saying is, unless you're using a really old compiler and >>> system (really really old) ... >>> main is a function that always returns int. Not void. Though some >>> compilers are kind of forgiving and will change it internally to int >>> anyway, just use int. >> >> It's been "int" since the first C compilers. There's some platforms >> that are more tolerant, but it's been that way since K&R1. >> >> -s >> > Perhaps it has. Doesn't matter since when. There are and were compilers > that accept it. There are (unfortunately) and were books that taught > void main for a long time. > I can only speculate that they did this to initially hide some details > from people just starting out with C. > Luckily it doesn't happen anymore, but a lot of those old books are > still floating around, not to mention old code... > I know the free Borland C++ compiler accepts void main(). I always used it for utility programs where I didn't care for the return from the program. My copy of K&R uses just main() for programs and the Borland compiler accepts it without any warnings.