From -5954481399940289776
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,314ebdf2ff957e27
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2003-04-23 19:17:48 PST
Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!newspump.monmouth.com!newspeer.monmouth.com!kibo.news.demon.net!mutlu.news.demon.net!demon!mail2news.demon.co.uk!devnull
From: a9804814@unet.univie.ac.at (Thomas Mang)
Newsgroups: comp.std.c++
Subject: Re: Why int main()?
Date: Thu, 24 Apr 2003 02:17:48 +0000 (UTC)
Organization: Customers chello Austria
Lines: 64
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <3EA7067C.BD7A6968@unet.univie.ac.at>
References: <Qbvla.955$5Z2.28625@newsfep1-win.server.ntli.net> <RkkxdPDmqwl+Ewp6@robinton.demon.co.uk> <3E9821CE.8AC8B8C6@web.de> <d6651fb6.0304150039.67fdce42@posting.google.com> <7f2735a5.0304161119.2d516e7d@posting.google.com> <Lbina.6887$Y57.3348@fe05.atl2.webusenet.com> <d6651fb6.0304230831.57a6e4f6@posting.google.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Trace: mail2news.demon.co.uk 1051150668 5457 10.0.0.1 (24 Apr 2003 02:17:48 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Thu, 24 Apr 2003 02:17:48 +0000 (UTC)
X-Received: from mulga.cs.mu.oz.au ([128.250.1.22])
	by news.demon.co.uk with esmtp (Exim 4.12)
	id 198WJ0-0001Ps-00
	for mail2news@news.news.demon.net; Thu, 24 Apr 2003 02:17:47 +0000
X-Received: from localhost (localhost [[UNIX: localhost]]) by mulga.cs.mu.OZ.AU
	id MAA26650; Thu, 24 Apr 2003 12:17:40 +1000 (EST)
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Path: comp-std-cpp-robomod!not-for-mail
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-Delivered-To: std-c++@ucar.edu
X-Accept-Language: de
X-Newsgroups: comp.std.c++
X-NNTP-Posting-Date: Wed, 23 Apr 2003 23:32:46 MEST
X-Spam-Status: No, hits=-6.2 required=5.0
	tests=FROM_ENDS_IN_NUMS,NOSPAM_INC,QUOTED_EMAIL_TEXT,REFERENCES,
	      SPAM_PHRASE_00_01,USER_AGENT_MOZILLA_XM,X_ACCEPT_LANG
	version=2.41
Xref: archiver1.google.com comp.std.c++:18923



James Kanze schrieb:

> ron@sensor.com ("Ron Natalie") wrote in message
> news:<Lbina.6887$Y57.3348@fe05.atl2.webusenet.com>...
> > "Allan W" <allan_w@my-dejanews.com> wrote in message
> > news:7f2735a5.0304161119.2d516e7d@posting.google.com...
> > > Suppose we insist that either main_t is a typedef for int, or else
> > > it is convertible from int. Most programs would need only one
> > > trivial change in order to be compatible; furthermore, on existing
> > > platforms, the code would continue to function properly until this
> > > change was made.
>
> > Great more godawful changes that make main different than every other
> > function.  This means more goofy stuff that has to get added to
> > something that knows it's compiling main and possibly additional
> > linkage overhead to support this.
>
> What needs to be added to the compiler?  All I see here is a typedef of
> main_t, in some header file.
>
> > > I've been a strong proponent of ignoring void main, even when the
> > > local platform supports it -- but my impression is that a LOT of
> > > people routinely use it, without even realizing it's wrong. Which
> > > makes me think that maybe we should support it after all. The C++
> > > standard is supposed to document existing practice, yes?
>
> > No.  The practice was wrong before, it is wrong now.  The C++ standard
> > only has a preference for things that were legal before, to avoid
> > making them illegal.
>
> Before the C standard, anything a compiler implementor wanted to do was
> legal:-).  (On the other hand, this void main business seems to be a
> recent phenomena.  I can't recall seeing any void main in the days when
> I was learning C.)
>
> > void main has never been legal in C or C++.
>
> I'd have to look that up in my K&R.  C90 didn't explicitly ban it,
> however.
>
> > The fact that it "happens to work OK" is not a compelling reason to
> > codify the bad practice.
>
> What's bad about it (except the formal issues)?  Most of my programs
> never return.

A point against "void main()":
It violates the overloading rules because we'd have then 2 functions differing
only in the return type.
OTOH, main is special anyways, why not make it special regarding this too,
since there is hardly an ambiguity to expect in practice........

regards,

Thomas

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]



