This is the mail archive of the gcc@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: [RFC] Deprecate "implicit int" for main() in C++


On 8 May 2018 at 12:35, Florian Weimer wrote:
> On 04/25/2018 04:40 PM, Jonathan Wakely wrote:
>>
>> More concretely, deprecating it for a few releases would allow us to
>> apply the attached patch at some point in the future, so that instead
>> of:
>>
>> rt.c:1:6: warning: ISO C++ forbids declaration of ‘main’ with no type
>> [-Wreturn-type]
>> main() { return 0; }
>>       ^
>>
>> We'd get:
>>
>> rt.c:1:6: error: ISO C++ forbids declaration of 'main' with no type
>> [-fpermissive]
>> main() { return 0; }
>>       ^
>
>
> I wonder if it's currently a warning because the implicit int is used in
> configure checks.  If this is the case, maybe we cannot make it an error
> without altering the result of configure tests?

Sigh, you're probably right. Since GCC 8.1 any such configure tests
will get a warning (or an error with -Werror) so maybe they'll
eventually get fixed.

Jason already expressed a preference for not making the change anyway.


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