Meson: Transition to `cxx_` as the prefix for C++

Created on 24 Apr 2018  路  5Comments  路  Source: mesonbuild/meson

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.

compilers enhancement options

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 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 ;)

All 5 comments

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:

  • the main C++ conference is called CppCon, not CxxCon
  • similarly for MeetingCpp con, which is not called MeetingCxx
  • the main podcast is called cppcast, not cxxcast

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jhasse picture jhasse  路  5Comments

denizzzka picture denizzzka  路  4Comments

eyelash picture eyelash  路  4Comments

elig0n picture elig0n  路  5Comments

amitdo picture amitdo  路  6Comments