I'd track a stack of control-flow preprocessor lines tracking whether to keep or discard the lines between them, inserting #line where needed. This is how I'd handle #if, #elif, #else, #endif, #ifdef, #ifndef, #elifdef, #elifndef.

Some of these take identifiers whose presence it should check in the macros table, others would interpret infix expressions via a couple stacks & The Shunting Yard Algorithm. Or they simply end a control-flow block.

#undef removes an entry from the macros table.

3/4

@joe before C23, Spanish speakers would use the longer spelling in place of #elifndef:

#elif !defined(...)¡

The C23 standard introduces new preprocessor directives, `#elifdef` and `#elifndef`, in recognition of the Spanish-speaking C community

@hackernews

Date Event
7 February ISO C++ Committee meeting Zoom plenary
15 February Visual Studio 2022 17.1
25 March Clang14.0
6 April ACCU, till 9th April
13 April 2022 Boost 1.79: Major release now available
2 May Val Announced at Cpp Now
6 May GCC 12.1
10 May MSVC’s STL Completes /std:c++20 (for the second time :)
22 July Carbon announced at C++North
25 July ISO C++ Committee meeting Zoom plenary, C++23 is frozen now
9 August Visual Studio 2022 17.3
19 August GCC 12.2
6 September Clang 15.0
11 September CppCon, till 16th Sept
16 September CppFront announced at CppCon
7 November ISO C++ Committee meeting - Kona Hybrid, till 12th Nov
8 November Visual Studio 2022 17.4
16 November Meeting C++, till 19th Nov
30 November 2022 Chat GTP Announced
14 December Boost 1.81: Major release now available
22 December libstdc++: Implement C++20 time zone support in <chrono>
........
Compiler missing features/notes
GCC 11 Only Modules are in the “partial” state
Clang 14/16 Modules in partial, coroutines in partial, CTAD improvements missing
MSVC 16.9 Full support!
........
Feature GCC Clang MSVC
Make () more optional for lambdas 11.0 13.0 x
if consteval 12.0 14.0 x
Deducing this x x VS 2022 17.2 (partial)
Multidimensional subscript operator 12.0 x x
#elifdef and #elifndef 12.0 13.0 x
static operator() 13.0 16.0 x
static operator[] 13.0 16.0 x
Support for UTF-8 as a portable source file encoding 13.0 15.0 VS 2015
.......
Feature GCC Clang MSVC
Stacktrace library x x x
std::is_scoped_enum 11.0 12.0 VS 2022 17.0
contains() for strings and string views 11.0 12.0 VS 2022 17.0
constexpr for std::optional and std::variant 12.0 13.0 VS 2022 17.1
std::out_ptr(), std::inout_ptr() x x VS 2022 17.0
ranges::starts_with() and ranges::ends_with() x x VS 2022 17.1
DR: std::format() improvements 13.0 16.0 VS 2022 17.2
ranges zip 13.0 15.0 VS 2022 17.3
Monadic operations for std::optional 12.0 14.0 VS 2022 17.2
<expected> 12.0 16.0 VS 2022 17.3
ranges::to x x VS 2022 17.4
Pipe support for user-defined range adaptors x x VS 2022 17.4
ranges::iota(), ranges::shift_*() x x VS 2022 17.4
views::join_with 13.0 x VS 2022 17.4
views::chunk_* and views::slide 13.0 x VS 2022 17.3
views::chunk_by 13.0 x VS 2022 17.3
<flat_map>, <flat_set> x x x
Formatted output library <print> x x x
Formatting ranges x x x
constexpr for integral overloads of std::to_chars() and std::from_chars() 13.0 16.0 VS 2022 17.4
Standard Library Modules x x VS 2022 17.5*
Monadic operations for std::expected x x x
.........
Compilers Used

What compiler do you use?
Answer 2022 2021 2020 2019
GCC 70.9% 76% 70.3% 75.6%
Clang 46.1% 51.8% 49.6% 58.7%
MSVC 54.7% 54.1% 58.5% 56.3%
Intel Compiler 2.5% 2.3% 2.8% 3.1%
C++ Builder 1.1% 2.2% 3% 1.2%

(The numbers for the above do not sum to 100%)
What IDE do you use for C++ projects
Answer 2022 2021
Visual Studio 48.2% 48.8%
Visual Studio Code 49.3% 47.1%
CLion 19.3% 18.5%
C++ Builder IDE 1.5% 2%
Eclipse 6.2% 5.8%
Vim/Emacs 24% 26.9%
QT Creator 14.6% 15.7%
Notepad++ 9.1% 7.4%
XCode 6.8% 6.1%
What additional tools do you use?
Answer 2022 2021 2020 2019
Debugger 74.3% 80.8% 77% 83.6%
Sanitizers 36.8% 38.9% 31.9% 40.4%
Static Code Analysis 57.2% 58.7% 60.9% 55.7%
Profilers 43% 49.1% 53.4% 56.8%
Clang Format 45% 49.4% 43.3% 49.3%
CMake 64.9% 67.3% 62.3% 66%
Package Managers 25.3% 26.2% 23.2% 21.4%
.......
Summary
....
C++ is at a crossroads today: on one side, it’s in really good shape, with lots of new features, compiler support, and cool tools (even better-debugging performance!). But at the same time, many experts struggle to make language inherently safer and fix some long-standing issues ( breaking ABI discussion). That’s why some experts try to start from something fresh and improve C++ by creating a new competition. Those new languages directly compile to C++ (as CppFront), or have robust interoperability with C++ (like Carbon). So maybe in the future, you’ll be writing in a super safe C++2 language and still have some legacy files in good old modern C++ in the same projects. I hope “friendly competition” will push C++ to new directories and get us better features and safer code.

What’s more ChatGPT merges, so who know if we’ll still be coding next year :)

I read „C++ at the end“ and was very happy for a short moment.

But it was „C++ at the end of 2022“ and talked about things to come. Like ‚#elifndef‘ (supposedly we‘ll #ifdef around that for portability).

People, this human thinks that C++ needs to be nuked from orbit. It has already been bad 30 years ago. And more lipstick does not change my mind.😌

https://www.cppstories.com/2022/cpp-status-2022/

C++ at the end of 2022

I must admit that some previous years for C++ might feel a bit “boring” and “stable”. New features, new standard every three years, meetings, conferences… life as usual (apart from some additional World/Economy/public Health events…). This year seems different as it looks like a “breakpoint” in the history of C++… and who knows where it will lead us.

C++ Stories
No Us Without You - elifdef and elifndef

The C Meeting has ended officially as of like less than 2 hours ago. I will write all about what happened in a later post, but I wanted to talk specifically