This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: c++/10569: use typedef type as return from main yields warning


The following reply was made to PR c++/10569; it has been noted by GNATS.

From: Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
To: bangerth@dealii.org
Cc: gcc-bugs@gcc.gnu.org, wxy@kivera.com, gcc-gnats@gcc.gnu.org
Subject: Re: c++/10569: use typedef type as return from main yields warning
Date: 30 Apr 2003 20:26:07 +0200

 bangerth@dealii.org writes:
 
 > Old Synopsis: use typedef type as return from main
 > New Synopsis: use typedef type as return from main yields warning
 > 
 > State-Changed-From-To: open->analyzed
 > State-Changed-By: bangerth
 > State-Changed-When: Wed Apr 30 18:02:19 2003
 > State-Changed-Why:
 >     Confirmed with present 3.4. The standard says in 3.6.1.2:
 >     
 >     An implementation shall not predefine the main function.   This  func-
 >       tion  shall  not  be  overloaded.  It shall have a return type of type
 >       int,...
 >     I can't say whether this rules out having a typedef to
 >     int instead. I think the answer is: don't do it, there's
 >     no good reason for such bogosity.
 
 There's something weird going on, though. For me, it fails with
 *error* when turning on -Wall, but not when additionally giving
 -pedantic:
 
 falk@juist:/tmp% g++ --version
 g++ (GCC) 3.4 20030423 (experimental)
 falk@juist:/tmp% g++ -O2 test.cc      
 falk@juist:/tmp% g++ -O2 -Wall test.cc
 test.cc:2: error: return type for `main' changed to `int'
 falk@juist:/tmp% g++ -O2 -Wall -pedantic test.cc
 test.cc:2: warning: return type for `main' changed to `int'
 
 Adding -Wall shouldn't make any program fail, I think.
 
 -- 
 	Falk


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]