www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/05/23/19:15:21

From: XXguille AT XXiies DOT XXes (Guillermo Rodriguez Garcia)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: STL
Date: Sun, 23 May 1999 22:14:57 GMT
Organization: Telefonica Transmision de Datos
Lines: 33
Message-ID: <37497c89.11751624@noticias.iies.es>
References: <373B3FD7 DOT 7D692AD2 AT alphalink DOT com DOT au> <373E8A8C DOT 87D93E54 AT earthlink DOT net> <37412752 DOT 914433 AT noticias DOT iies DOT es> <7hpdo5$m6k$1 AT news DOT doit DOT wisc DOT edu>
NNTP-Posting-Host: iies227.iies.es
Mime-Version: 1.0
X-Newsreader: Forte Agent 1.5/32.451
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

El día 17 May 1999 15:48:21 GMT, khan AT xraylith DOT wisc DOT edu (Mumit Khan)
escribió:

>>Note that while this is true for C, it is not for C++; in which you
>>can perfectly define main() as returning void, according to the ISO
>>standard.
>
>Wrong. Please check the standard (cf: 3.6.1) before making such 
>assertions.

After some discussion in es.lenguajes.c and es.lenguajes.c++ (spanish
newsgroup discussing c and c++ languajes), many people say that
according to the ISO standard, void main() is not incorrect, but
implementation dependent. That is, it is not portable, yet it is
allowed by the standard if the compiler chooses to support it.

It seems that the ISO standard forces a conforming implementation of
the language to support both int main() and int main(int, char **),
but otherwise main can be defined as returning a different type,
altough this is implementation-defined.

Someone said that even Bjarne Stroustrup, in comp.lang.c++.moderated
and comp.std.c++, pointed out that void main() is not incorrect,
altough not recommended.

What do you think?

Regards,
GUILLE

----
Guillermo Rodriguez Garcia
XXguille AT XXiies DOT XXes (ya sabes :-)

- Raw text -


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