[clang-tools-extra] Add new check: do not return 0; at the end of main() in C++ (PR #77586)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 10 04:53:41 PST 2024


AaronBallman wrote:

> I'm not fan about this check. For me there is no use case for it.

Yeah, I don't see much motivation for the check. I know that once upon a time (my grey beard is showing, lol) there were compiler bugs in some implementations where a missing return statement in `main` would not return 0 as the standard required. However, I did some cursory searching on the web and don't see evidence that this problem exists in the wild any longer.

Do any of the current coding style guides we have checks for explicitly require the return in `main` or require it not be present? Maybe that would be more motivating?

https://github.com/llvm/llvm-project/pull/77586


More information about the cfe-commits mailing list