Re:.C as a file extension for C++ is not portable
by jagged-chisel on Friday May 14, 2021 @06:35AM
(#27152766)
This doesn’t speak to why the problem occurs. You didn’t even answer the question you quoted.
Re:.C as a file extension for C++ is not portable
by FearNotDaniel on Friday May 14, 2021 @08:35AM
(#27153541)
I don't work in C or C++ but I'm inferring from the context and other comments that it's actually because .c (lower case) is used to indicate C language code and .C (upper case) means C++ code. This then fails on windows because the OS is not case-sensitive wrt filenames.
So to make the implied answer to the question explicit: no, it's because someone who knew the difference between C and C++ sought to distinguish between their source code files using a filename extension convention that becomes invisible on a different OS.
No[1]:
> C++ source files conventionally use one of the suffixes `.C`, `.cc`, `.cpp`, `.CPP`, `.c++`, `.cp`, or `.cxx`; C++ header files often use `.hh`, `.hpp`, `.H`, or (for shared template code) `.tcc`; and preprocessed C++ files use the suffix `.ii`. GCC recognizes files with these names and compiles them as C++ programs even if you call the compiler the same way as for compiling C programs (usually with the name gcc).
[1] https://gcc.gnu.org/onlinedocs/gcc/Invoking-G_002b_002b.html