Currently we use cpp to mean the C++ compiler, f.ex.: cpp_args, get_compiler('cpp'), etc. However, this is ambiguous and confusing for some people since 'cpp' usually means 'C Pre-Processor', not 'C-Plus-Plus Compiler'.
cxx is completely unambiguous, and we should use that internally and externally in the codebase. For backwards-compatibility, we should continue to accept cpp for the foreseeable future.
We are already inconsistent by necessity, For example, we read C++ arguments from the CXXFLAGS environment variable, and read C Pre-Processor args from the CPPFLAGS environment variable.
On Tue, Apr 24, 2018 at 5:58 AM, Nirbheek Chauhan notifications@github.com
wrote:
Currently we use cpp to mean the C++ compiler, f.ex.: cpp_args,
get_compiler('cpp'), etc. However, this is ambiguous and confusing for
some people since 'cpp' usually means 'C Pre-Processor', not 'C-Plus-Plus
Compiler'.cxx is completely unambiguous, and we should use that internally and
externally in the codebase. For backwards-compatibility, we should continue
to accept cpp for the foreseeable future.
No. Back when this decision was made, I _specifically_ chose cpp rather
than cxx. There are many reasons for this, but perhaps the biggest one is
that the C++ community has standardised on 'cpp' as the spelling. Cxx is
only used by people who are mostly C programmers (and usually hate C++) or
other such people who have picked it up from Autotools' envvar names. Cpp
is the default file extension most people use (the remaining use .cc,
extremely few use .cxx), in addition:
And so on and so on. Cpp is the contemporary ASCII representation of C++.
The only place where CXX is even needed is when getting the compiler flags
from envvars, and even for that it is not mandatory, since we have
-Dcpp_args for that. The only people who should even know that CXXFLAGS
exists are distro packagers. The naming is unfortunate but that's legacy
and backwards compatibility for you.
IMO the cosmetic advantage of using the 'official acronym' is greatly offset by the constant confusion people have because of the ambiguity between C/C++ Pre-Processor and C++ compiler.
Every build system out there (including cmake, which the majority of C++ projects use) uses cxx to mean C++. The filenames do end in cpp because nothing else uses that extension, but for prefixes, cpp is universally known to mean "C/C++ Pre-Processor".
Also, we need CXX in one more place: overriding the default C++ compiler used by Meson. I dunno, seems weird ;)
I for one had to look up how to use meson with c++ because it is using the c preprocessor acronym. It is a minor speedbump but it does give a bad first impression.
My most common mistake when writing meson files from scratch is writing cxx_std= because I always set that variable to something.
Most helpful comment
IMO the cosmetic advantage of using the 'official acronym' is greatly offset by the constant confusion people have because of the ambiguity between C/C++ Pre-Processor and C++ compiler.
Every build system out there (including cmake, which the majority of C++ projects use) uses
cxxto mean C++. The filenames do end incppbecause nothing else uses that extension, but for prefixes,cppis universally known to mean "C/C++ Pre-Processor".Also, we need
CXXin one more place: overriding the default C++ compiler used by Meson. I dunno, seems weird ;)