5 ms·
>> Is this something that happens because someone thinks C/C++ is one language? No[1]: > C++ source files conventionally use one of the suffixes `.C`, `.cc`,
by nanis 5y ago
>> Is this something that happens because someone thinks C/C++ is one language?
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 https://gcc.gnu.org/onlinedocs/gcc/Invoking-G_002b_002b.html
- jagged-chisel 5y agoThis doesn’t speak to why the problem occurs. You didn’t even answer the question you quoted.
- FearNotDaniel 5y agoI 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.