www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/05/20:32:19

From: Erik Max Francis <max AT alcyone DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: void main ?
Date: Thu, 03 Jul 1997 07:32:25 -0700
Organization: Alcyone Systems
Lines: 22
Message-ID: <33BBB7F9.7990BD53@alcyone.com>
References: <resta-0307971339210001 AT mac-resta DOT imc DOT pi DOT cnr DOT it>
NNTP-Posting-Host: newton.alcyone.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Giovanni Resta wrote:

> I always declared main as void in the past 5 years and
> I never get an error, so I'm curious about the topic.
> (I must admit that I never had to test the 'exit code' of a program,
> maybe that can change things)

There are only two valid ANSI C prototypes for main:

    int main(void);
    int main(int argc, char *argv[]); /* the names of the arguments can 
                                         vary, of course */

This is clearly indicated in section 5.1.2.2.1 of the ANSI C standard.

-- 
       Erik Max Francis, &tSftDotIotE / email / max AT alcyone DOT com
                     Alcyone Systems /   web / http://www.alcyone.com/max/
San Jose, California, United States /  icbm / 37 20 07 N  121 53 38 W
                                   \
     "Covenants without the sword / are but words."
                                 / Camden

- Raw text -


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