delorie.com/archives/browse.cgi | search |
Newsgroups: | comp.os.msdos.djgpp |
From: | Peter Berdeklis <peter AT atmosp DOT physics DOT utoronto DOT ca> |
Subject: | Re: main() {...} (was: using rhide) |
Message-ID: | <Pine.SGI.3.91.970129172453.2282B-100000@chinook.physics.utoronto.ca> |
Nntp-Posting-Host: | chinook.physics.utoronto.ca |
Sender: | news AT info DOT physics DOT utoronto DOT ca (System Administrator) |
Mime-Version: | 1.0 |
Organization: | University of Toronto - Dept. of Physics |
In-Reply-To: | <32EBD708.3A72@cs.com> |
Date: | Wed, 29 Jan 1997 22:28:48 GMT |
References: | <01bbf2bd$ec4f95c0$590520ce AT d-moran> <01bc0b1f$c48e8ee0$94b15380 AT maan-m DOT -hamze> <5cfriq$1ql AT news1 DOT panix DOT com> <32eb7846 DOT 2272143 AT ursa DOT smsu DOT edu> <32EBD708 DOT 3A72 AT cs DOT com> |
Lines: | 21 |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Implicit void in an empty argument list is ANSI compliant C, and proper C++ (according to the draft standard). Implicit int is ANSI compliant C (unfortunately), but not proper C++. --------------- Peter Berdeklis Dept. of Physics, Univ. of Toronto On Sun, 26 Jan 1997, John M. Aldrich wrote: > You can use either int main( void ) or int main( int argc, char **argv ) > depending on what your program needs to do. (Note BTW that I use **argv > instead of *argv[]; I have heard that the latter will not work with a > few compilers.) But omitting the return type and the void argument is > just not a safe practice, and later versions of gcc will give you > warnings if you omit them, especially when compiling C++. > > The C++ spec is even less forgiving of default return types and empty > arglists than the C spec.
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |