C++ Logo

SG12

Advanced search

Subject: Re: [ub] What does "The function main shall not be used within a program" mean?
From: Stephen Clamage (stephen.clamage_at_[hidden])
Date: 2014-01-22 01:13:44


On 1/21/2014 17:57, David Krauss wrote:
> On Jan 22, 2014, at 9:08 AM, Stephen Clamage <stephen.clamage_at_[hidden]> wrote:
>
>> If you could declare
> Is the intent to prohibit forward declaration? This would seem to be the difference between use and ODR-use in the original question.
>
I thought I remembered an explicit prohibition against declaring main, but I
don't find it in any issues of the C++ standard, C++98, 03, 11, or the C++14
draft.

On 1/21/2014 22:13, Ville Voutilainen wrote:
> I don't want a recursive main. I want such shenanigans to be ill-formed.
> Implementations don't seem to agree, and I want to know whether
> our current wording intends such things to be ill-formed or UB.

All issues of the standard explicitly forbid calling main recursively, in 5.2.2/9.

- Steve


SG12 list run by herb.sutter at gmail.com