Remember that JUCE allows integration of C and C++ external libraries, so marking main extern "C" is actually important, and is a standard practice when it comes to mixing C and C++ libraries.
Interesting - it looks like this change was made very deliberately, but the reasons aren’t clear to me. extern "C" was added in this commit:
I can try removing it and see whether our internal CI still passes.
Is this causing any concrete problems for you, or are you just trying to aim for C++ standards conformance? In the latter case, although extern "C" isn’t explicitly allowed, it also doesn’t seem to be explicitly _dis_allowed (on cppreference, I haven’t checked the standard itself), so maybe this is still conformant.
I’m not convinced by this argument. extern "C" will set function name-mangling and ABI so that the function can be linked and called successfully from a C program. It doesn’t have any effect on the body of the function, or on further functions called from within the function marked extern "C".
The current problem I’m facing is that it causes build failures due to having warnings-as-errors enabled. I can of course disable this specific error, or relegate it back to a warning.
It’s flagged by clang 20. I believe that if they choose to see this as a mistake it probably is.
extern "C" will set function name-mangling and ABI so that the function can be linked and called successfully from a C program.
Yes, and it should be noted, this name-mangling will not be applied to main with this declaration, as is appropriate.
It doesn’t have any effect on the body of the function, or on further functions called from within the function marked extern "C".
Exactly, which is why this is a non-issue and shouldn’t be removed.
On the other hand, what utility does it provide? The ability to use __attribute__((constructor)) in a C library, which can then find and call main() as needed, without programmer intervention. Useful for debugging and profiling tools …