Topic: Void main() -- 0 Prologue


Author: JdeBP@jba.co.uk (Jonathan de Boyne Pollard)
Date: 1995/06/06
Raw View
Steve Clamage (clamage@Eng.Sun.COM) wrote:
: According to the language definition, main() returns an int value to
: the environment which invokes the program. Thus, conforming code
: must declare main to return an int.

: Some implementations, as an extension, allow you to declare main
: to return nothing (void). Such code is not portable and will not
: compile on all systems, since it violates the language definition.

AHEM!  Not by my reading.

It's probably time to throw this one out to the masses.  I've sent a couple
of private mails on this subject to some people, and received zero replies.
Maybe you lot here will have a go.

In this and the next few articles, I'm going to pick a few holes in
[basic.start.main], in the hopes that they are plugged, or properly
codified.  I think that since the "void main()" thread is such a perennial
one (those who think otherwise should try hanging out in places such as the
FIDONET CPLUSPLUS echo) we really should be looking to the standard for
the definitive answer, and as it stands the standard is inconsistent and
incomplete when it comes to the definition of the distinguished
function `main'.

All right.  Head above parapet.  Here goes ...