C++ Logo

sg12

Advanced search

Re: [ub] What does "The function main shall not be used within a program" mean?

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Wed, 22 Jan 2014 12:08:54 +0200
On 22 January 2014 12:07, Ville Voutilainen <ville.voutilainen_at_[hidden]> wrote:
> On 22 January 2014 09:13, Stephen Clamage <stephen.clamage_at_[hidden]> wrote:
>> All issues of the standard explicitly forbid calling main recursively, in 5.2.2/9.
>
> Thanks. Minor nit: it says
> "Recursive calls are permitted, except to the function named main (3.6.1)."
> Since there's that cross-reference, it's otherwise correct, but I'd prefer it
> to say "to the main function" instead of "to the function named main", since
> nothing prevents me from having functions named main in user-defined namespaces
> or as member functions of classes. That's perhaps not a topic for this
> particular
> study group, though.

Oh. I forgot to mention that with that wording, it's again unclear to me whether
such recursive call is ill-formed or UB.

Received on 2014-01-22 11:08:55