Sender: crough45 AT amc DOT de Message-Id: <97Jul5.152902gmt+0100.16642@internet01.amc.de> Date: Sat, 5 Jul 1997 14:32:55 +0100 From: Chris Croughton Mime-Version: 1.0 To: andrewc AT typhoon DOT rose DOT hp DOT com Cc: djgpp AT delorie DOT com Subject: Re: void main ? Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Precedence: bulk Andrew Crabtree wrote: > Sure, for the i386 class machines I would agree > that void main is never going to cause any problem > other than a garbage return value. The point I think > was that on other architectures (I can't think of any > modern ones, maybe the 6502), return values may go on > a stack, in which case you could have problems. Well, it's nothing to do with the machine architecture, if anything it's an O/S or command shell problem. But in the last 20 years I haven't seen this give any problems on any system capable of running C code. If you have, please tell me what. There is a lot of code which does not need the return value of main ever, because main should never return. This includes all embedded software (mobile phones being the most ubiquitous example, since all phone software I've seen is written in C/C++). The only case where there's likely to be unexpected action on the return code is if it's called from a makefile, and the code most people write is unlikely to be called like that (ever seen a game called from a makefile?). If a person is writing code for use with make or shell scripts which test the return value then it's up to them to make it return something sensible. However, just forcing a return of some kind doesn't make the value meaningful... Chris C