Subject: Re: main return...
To: Erik M. Theisen <etheisen@teclink.net>
From: John F. Woods <jfw@FunHouse.com>
List: current-users
Date: 03/29/1996 08:39:18
> Maybe this is compiler specific, but there is also a:
> 	int main(int argc, char **argv, char **envp)
> The third param is the exec's environment vars.

The ANSI Standard says that this is illegal, invoking undefined, undiagnosed
behavior.  The POSIX standard adds the requirement of conforming POSIX systems
that they must accept this non-ANSI-conforming extension and do the right
thing.

> Does the standard really say "void main(void)" or 
> "void main(int argc, char**argv) is a nogo?  This seems wierd.

The Standard says that main shall be declared as either

	int main(void);
or
	int main(int, char **);

or the appropriate non-prototyped equivalents.  Failure to meet an explicit
requirement of the standard invokes undefined behavior, etc.