[cfe-dev] Calling main() is ub based optimizations

David Chisnall via cfe-dev cfe-dev at lists.llvm.org
Mon Nov 14 02:48:19 PST 2016


On 14 Nov 2016, at 09:43, Eric Fiselier via cfe-dev <cfe-dev at lists.llvm.org> wrote:
> 
> 
> 
> On Sat, Nov 12, 2016 at 11:09 AM, Mehdi Amini via cfe-dev <cfe-dev at lists.llvm.org> wrote:
> main is marked as “norecurse” in C++ and not in C:
> 
> I would be interested in seeing the standardese associated with each behavior.
> 
> /Eric

Indeed.  If I implement main in C++ and call it from C, or implement main in C and call it from C++, is it undefined behaviour in both cases?  This seems like a very odd inconsistency if I have to know the source language for both the caller and callee to determine whether something is UB.

David




More information about the cfe-dev mailing list