www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/07/05/21:46:49

Xref: news2.mv.net comp.os.msdos.djgpp:5692
From: Tom Wheeley <tomw AT tsys DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Does DJGPP conform to ANSI-C standards with the for () ?
Date: Fri, 05 Jul 96 23:14:51 GMT
Organization: City Zen FM
Lines: 41
Message-ID: <836608491snz@tsys.demon.co.uk>
References: <199606250925 DOT NAA27938 AT video DOT yars DOT free DOT net> <31D15300 DOT 129C86C6 AT laden DOT ilk DOT de> <4qu19j$d5v AT hagar DOT cyberoptics DOT com>
Reply-To: tomw AT tsys DOT demon DOT co DOT uk
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <4qu19j$d5v AT hagar DOT cyberoptics DOT com>
           rudd AT cyberoptics DOT com "Eric Rudd" writes:

> In section 5.1.2.2.3, the ANSI document states "If the main function 
> executes a return that specifies no value, the termination status 
> returned to the host environment is undefined."  It is therefore implied 
> that "void main" is not an error.

From my experience on comp.lang.c, you are misreading this.  The paragraph
means that if you just fall off the end of main(), without using return
or exit(), *then* the return value is undefined.  This is different from
the undefined *behaviour* of void main.  The first can make your OS do
funny things, the second your program.

Consider this excerpt from <http://www.lysator.liu.se/c/schildt.html>

----- 8< -----

(standard)
"You are therefore free to declare main() as required by your program."

(critique of schildt)

This statement is immediately followed by the example:
    void main (void)
even though the text of the standard directly opposite states that this is
undefined.  Indeed, the text I quote makes me wonder whether Schildt believes
that:

    struct foo { int i; double d; } main (double argc, struct foo argv)

is permitted !

----- 8< -----

..splitbung
-- 
* TQ 1.0 * The 'Just So Quotes'.
"I'm a paranoid agnostic. I doubt the existence of God, but I'm sure there is
some force, somewhere, working against me." --Marc Maron

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019