[ub] What does "The function main shall not be used within a program" mean?
Ville Voutilainen
ville.voutilainen at gmail.com
Wed Jan 22 07:13:47 CET 2014
On 22 January 2014 03:08, Stephen Clamage <stephen.clamage at oracle.com> wrote:
> Historically, function main in C++ often needed to perform some magic,
> and the actual implementation of main might not behave in the same way
> as an ordinary function with the same definition. If you could declare
> or call main, or take its address, results would be unpredictable. Thus,
> the restrictive rules allow main to be special, where needed.
>
> If you want a recursive main, or want to *do* something with it, you can
> write mymain as an ordinary function, and have the real main just call
> it. Example, for the case of using only argc and argv:
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.
More information about the ub
mailing list