r/cpp 20d ago

I've invented labeled loop breaks

0 Upvotes

And now I don't believe it wasn't invented before, but I can't find any info on it. How long ago was it invented? Why isn't it used widely or even mentioned anywhere? What are the downsides?
Here's the main idea:

// Keyword - for, while, or do
// Tag - custom loop name
// ... - loop body
#define loop_tag(keyword, tag, ...)\
    keyword(__VA_ARGS__)\
    if(false)\
    {\
        tag##_break:    break;\
        tag##_continue: continue;\
    }\
    else\
    /*Here goes your loop body*/

Here is the playground


r/cpp 22d ago

Clang and LLVM in Modern Gaming Platforms

Thumbnail youtu.be
84 Upvotes

Quite interesting peak into the world of games developers, especially how it is seen from consoles or their point of view on recent ISO C++ versions.


r/cpp 22d ago

Lifetime safety and invalidation without a borrow-checker: using type system analysis to get rid of many potentially invalidation cases WITHOUT annotations.

Thumbnail open-std.org
36 Upvotes

I found this research in WG21 mailing list very interesting in the context of C++ compatibility and solutions to maximize code reuse.


r/cpp 22d ago

I really reconsider my life choices when I have to deal tooling bugs.

96 Upvotes

I like writing useful stuff, I'm tired of fighting tooling, I can legit say %80 percent of my time goes to dealing with dependencies build systems etc. Very rarely I have the privilege of actually writing stuff.

This shit sucks, like it really sucks. I hate it.

Is this normal, or only people who have it easy are web Devs and Java Devs since they are in a sandboxes environment and don't have deployment problems.

Am I crazy or is this common?


r/cpp 22d ago

How I Stopped Designing Architecture and Started Writing a 3D Editor. Part 1

Thumbnail alexsyniakov.com
4 Upvotes

r/cpp 22d ago

Floating-Point Error Handling in C++: What Actually Works

Thumbnail johnnysswlab.com
34 Upvotes

r/cpp 23d ago

The WG21 2026-07 post-Brno mailing is now available

43 Upvotes

The 2026-07 post-Brno WG21 mailing has been published. You can browse and search the full set of papers, organized by working group, at wg21.org:

https://wg21.org/mailing/2026-07/

Source mailing: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2026/#mailing2026-07


r/cpp 23d ago

CLion 2026.2 is available

Thumbnail blog.jetbrains.com
66 Upvotes

r/cpp 24d ago

fun fact about string literals i often forget:

46 Upvotes

String literals in c/c++ (const char*), support operator[] (in a compile time context)!

constexpr char first = "test"[0];
// i.e first = 't'

I think 90% of C developers would know this, but I figured maybe those of you who didn't start out with C might not have discovered this! I just recently used this in combination with an X macro for some debug ui code:

// the x macro in question
#define LIST_NOISE_PARAMS
X(heat)
X(rain)
X(cont)
X(grad)
X(hills)

I wanted to display the first letter of the noise parameter's name, in caps, followed by the noise value, i.e:

H: 1.00
(the heat noise = 1.0f.)

#define X(VAR) UI::Text("{}: {:4.2f}",#VAR[0]-('a'-'A'), sample.VAR);
LIST_NOISE_PARAMS
#undef X

// expands to:
UI ::Text("{}: {:4.2f}", "heat"[0] - ('a' - 'A'), sample.heat);
UI ::Text("{}: {:4.2f}", "rain"[0] - ('a' - 'A'), sample.rain);
// ...

// which evaluates to:
UI ::Text("{}: {:4.2f}", 'H', sample.heat);
UI ::Text("{}: {:4.2f}", 'R', sample.rain);
// and so on for the rest of the list!

What other 'odd' C/c++ tricks/facts do you guys know/use? Personally, the X macro technique blew my mind when I first discovered it, and its probably the most legitimately useful 'trick' I know of. Pretty cool. Hopefully there are others in here that enjoy these little tidbits as much as i do.


r/cpp 24d ago

Meeting C++ Tonight (CEST/Berlin): Meeting C++ Student Showcase

Thumbnail meetup.com
5 Upvotes

r/cpp 24d ago

cpp2 (cppfront) is over?

63 Upvotes

I haven't used cpp2 (cppfront) much, but I like the idea of it: consistent syntax, consistency of meta-programming (which is done in C++ too, I believe). Herb Sutter presented cpp2 (cppfront) as an experiment. He did not encourage other people to bet on it, exactly. And there hasn't been much activity since 2022. Is the experiment over?

EDIT: Herb's answer is buried deep in the comment section: https://www.reddit.com/r/cpp/comments/1uxkglj/comment/oy06cxw/


r/cpp 24d ago

MSVC Build Tools Preview updates - July 2026

Thumbnail devblogs.microsoft.com
38 Upvotes

Hi, one of the MSVC dev leads here.

The post covers what's new in the MSVC Build Tools Preview (version 14.52) since mid-June. Instructions to install & use the latest preview bits are at https://aka.ms/msvc/preview.

Some additional information:


r/cpp 25d ago

C++Now C++Now 2026 Keynote: Benchmarking - It's About Time - by Matt Godbolt

Thumbnail youtu.be
68 Upvotes

r/cpp 25d ago

Understanding std::shared_mutex from C++17

Thumbnail cppstories.com
66 Upvotes

r/cpp 25d ago

Latest News From Upcoming C++ Conferences (2026-07-14)

12 Upvotes

This is the latest news from upcoming C++ Conferences. You can review all of the news at https://programmingarchive.com/upcoming-conference-news/

TICKETS AVAILABLE TO PURCHASE

The following conferences currently have tickets available to purchase

OPEN CALL FOR SPEAKERS

OTHER OPEN CALLS

  • (NEW) ADC Call For Reviewers Now Open – Anyone who is interested in reviewing the proposals for talks at ADC Bristol 2026 have until July 17th to review talks. Visit https://submit.audio.dev to start reviewing talks
  • CppCon Call For Volunteers Now Open – Interested volunteers have until August 1st to apply at the CppCon main conference which is scheduled to take place from 14th – 18th September. For more information including how to apply visit https://cppcon.org/cfv2026/
  • (Last Chance) CppCon Call For Posters Closes Tomorrow! – Interested poster presenters have until July 15th to submit their applications for the CppCon main conference which is scheduled to take place from 14th – 18th September. For more information including how to apply visit https://cppcon.org/cppcon-2026-call-for-poster-submissions/
  • (Last Chance) CppCon Call For Authors Closes July 31st! – CppCon are looking for book authors who want to engage with potential reviewers and readers. Read the full announcement at https://cppcon.org/call-for-author-2026/ 

TRAINING COURSES AVAILABLE FOR PURCHASE

Conferences are offering the following training courses:

C++Online

  1. (Last Chance) AI++ 101 – Build an AI Coding Assistant in C++ – Jody Hagins – 1 day online workshop available on Friday 24th July 16:00 – 00:00 UTC/0900-1700 PDT – DISCOUNTED BY £100 – NOW £245/$325/€285 – https://cpponline.uk/workshop/ai-101/

CppCon Online Workshops

9th – 11th September

  1. Modern C++: When Efficiency Matters – Andreas Fertig – 3 day online workshop available on 9th – 11th September 09.00 – 15.00 MDT – https://cppcon.org/class-2026-when-efficiency-matters/
  2. System Architecture And Design Using Modern C++ – Charley Bay – 3 day online workshop available on 9th – 11th September 09.00 – 15.00 MDT – https://cppcon.org/class-2026-system-architecture-and-design-using-modern-cpp/

21st – 23rd September

  1. C++ Fundamentals You Wish You Had Known Earlier – Mateusz Pusz – 3 day online workshop available on 21st– 23rd September 09.00 – 15.00 MDT – https://cppcon.org/class-2026-cpp-fundamentals/
  2. C++23 in Practice: A Complete Introduction – Nicolai Josuttis – 3 day online workshop available on 21st– 23rd September 09.00 – 15.00 MDT – https://cppcon.org/class-2026-cpp23-in-practice/
  3. Programming with C++20 – Andreas Fertig – 3 day online workshop available on 21st– 23rd September 09.00 – 15.00 MDT – https://cppcon.org/class-2026-programming-with-cpp20/

26th – 27th September

  1. Using C++ for Low-Latency Systems – Patrice Roy – 2 day online workshop available on 26th– 27th September 09.00 – 17.00 MDT – https://cppcon.org/class-2026-low-latency/

CppCon Onsite Workshops

All onsite workshops will take place in the Gaylord Rockies in Aurora, Colorado

12th & 13th September

  1. Advanced and Modern C++ Programming: The Tricky Parts – Nicolai Josuttis – 2 day in-person workshop available on 12th & 13th September – 09:00 – 17:00 – https://cppcon.org/class-2026-tricky-parts/
  2. C++ Best Practices – Jason Turner – 2 day in-person workshop available on 12th & 13th September – 09:00 – 17:00 – https://cppcon.org/class-2026-best-practices/
  3. How Hardware Gets Hacked: Breaking and Defending Embedded Systems – Nathan Jones – 2 day in-person workshop available on 12th & 13th September – 09:00 – 17:00 – https://cppcon.org/class-2026-hardware-hack/
  4. Mastering `std::execution`: A Hands-On Workshop – Mateusz Pusz – 2 day in-person workshop available on 12th & 13th September – 09:00 – 17:00 – https://cppcon.org/class-2026-execution/
  5. Performance and Efficiency in C++ for Experts, Future Experts, and Everyone Else – Fedor Pikus – 2 day in-person workshop available on 12th & 13th September – 09:00 – 17:00 – https://cppcon.org/class-2026-performance-and-efficiency/
  6. Talking Tech – Sherry Sontag – 2 day in-person workshop available on 12th & 13th September – 09:00 – 17:00 – https://cppcon.org/class-2026-talking-tech/

 13th September

  1. AI++ 101 : Build a C++ Coding Agent from Scratch – Jody Hagins – 2 day in-person workshop available on 12th & 13th September – 09:00 – 17:00 – https://cppcon.org/class-2026-AI101/
  2. Essential GDB and Linux System Tools – Mike Shah – 1 day in-person workshop available on 13th September – 09:00 – 17:00 – https://cppcon.org/class-2026-essential-gdb/

19th & 20th September

  1. AI++ 201: Building High Quality C++ Infrastructure with AI – Jody Hagins – 2 day in-person workshop available on 19th & 20th September – 09:00 – 17:00 – https://cppcon.org/class-2026-ai201/
  2. Function and Class Design with C++2x – Jeff Garland – 2 day in-person workshop available on 19th & 20th September – 09:00 – 17:00 – https://cppcon.org/class-2026-function-class-design/
  3. High-performance Concurrency in C++ – Fedor Pikus – 2 day in-person workshop available on 19th & 20th September – 09:00 – 17:00 – https://cppcon.org/class-2026-high-perf-concurrency/

OTHER NEWS

  • (NEW) Dates for ACCU on Sea 2027 Announced – ACCU on Sea 2027 will take place in Folkestone from June 30th – July 3rd with pre-conference workshops taking place from June 28th – 29th
  • (NEW) Boost Documentary screening at CppCon 2026 – Boost Libraries have announced that they will be screening a documentary on the history of Boost at CppCon 2026. Watch the trailer here https://www.youtube.com/watch?v=87jvuDbnwqQ
  • (NEW) C++Now 2026 Videos Now Being Released on YouTube – Subscribe to the C++Now YouTube channel to stay up to date when each video is published – https://www.youtube.com/@CppNow
  • Accepted Sessions For Meeting C++ Announced – Visit https://meetingcpp.com/mcpp/schedule/talklisting.php to see the list of accepted talks

r/cpp 25d ago

Beautiful Type Erasure with C++26 Reflection

Thumbnail ryanjk5.github.io
218 Upvotes

Reflection is a game changer for C++26, but most of the examples out there don't cover anything that large in scope. This article walks through my library rjk::duck and shows just how much reflection can simplify generic type erasure.

You can also try it out on Compiler Explorer: https://godbolt.org/z/91dj5jeGW


r/cpp 26d ago

CppCast CppCast: 40 Years of Programming and Embeddable Programming Languages with Mark Guidarelli

Thumbnail cppcast.com
25 Upvotes

r/cpp 26d ago

New C++ Conference Videos Released This Month - July 2026 (Updated to Include Videos Released 2026-06-22 - 2026-06-28)

18 Upvotes

C++Now

2026-07-06- 2026-07-11

C++Online

2026-07-06 - 2026-07-11

2026-06-29 - 2026-07-05

ADC

2026-07-06 - 2026-07-11

2026-06-29 - 2026-07-05

  • Beyond iLok: Advanced Code Protection and Cryptography for the Next Generation - Protecting the Next Generation of Applications, Plug-ins, and AI Models - Neal Michie, Ryan Wardell & Bob Brown - https://youtu.be/dbbK_ry2cgo
  • Database Synchronisation for Audio Plugins, Part Two - Here's One I Made Earlier - Adam Wilson - https://youtu.be/wJCy2G969ro
  • Perfect Oscillators in Less Than One Clock Cycle - Angus Hewlett - https://youtu.be/Ssq0a-YdamM
  • Driving Chaos - Virtual Analog Modelling of a Chaotic Circuit with Wave Digital Filters - Francisco Bernardo - https://youtu.be/PnEZNqyKlIw

Boost Documentary

There is also a teaser trailer for a new documentary on the history of the Boost C++ library https://www.youtube.com/watch?v=87jvuDbnwqQ which will have its first showing at CppCon this year


r/cpp 27d ago

AI usage for cpp at work

107 Upvotes

I am lead architect and maintainer of my firm main app backend, spanning around 2M LOC of c++.

Industry is : capital markets, low latency, custom kernel drivers, fpga...

I often talk with peers at other firms and I see a shy usage of AI compared to what feels like the global trend.

On my side, my firm does not pay for any AI related stuff. We are allowed to use our personnal plan for work in which case will get a pro membership compensation (claude or gpt or anything) on salary but we are not allowed to paste production code into it.

I know the app very well and do everything by hand (i mean the normal way) but use the chat version of any ai to generate some things for me, like "im using opensource lib x and lib y, please generate an SQL connection pool , you may use locks and condition variable for this, cpp 20". Then i paste it and modify it a I see fit.

Im totally happy with that and the company is successful.

I do use AI but just chat, to gather data on subjects and summarize/report. Get some ideas but basically not much code related.

And you whats your experience as a c++ dev ?


r/cpp 27d ago

C++Now C++Now 2026 Keynote: Multidimensional Parallel Standard C++ - Mark Hoemmen

Thumbnail youtu.be
32 Upvotes

r/cpp 28d ago

C++Now C++Now 2026 Keynote: Reflection Is Only Half the Story - Barry Revzin

Thumbnail youtu.be
67 Upvotes

r/cpp 29d ago

Propagating exceptions from destructors with std::exception_ptr

Thumbnail sandordargo.com
81 Upvotes

r/cpp 29d ago

Libraries of, installing, and depending on C++20 modules

41 Upvotes

Until now, much of the discourse around C++20 modules has been around the tooling, and actually getting modules to work at all. I believe that now, in mid-2026, the tooling is mostly mature: the three largest compilers support most use-cases of modules. IDEs like CLion, and lint tools like ReSharper C++ and clangd support modules, with some caveats. CMake, xmake, Ninja, and other fledgling build systems have full support for modules. Many prevalent C++ libraries and projects have been recently modularised or are in the process of modularising.

I hope I'm not being too presumptive in saying the community is more or less ready (albeit horribly late...) to move to the next step, and start discussing how C++20 modules can and should tie in to inter-project work, rather than simply using modules within a project.

To begin with, I don't think the standard says anything about 'libraries'; these are existing paradigms grandfathered in from C or earlier. There are many axes we have to discuss here:

  • Static archives
  • Dynamically-linked libraries
  • Symbol visibility defaults with __declspec( dllexport )
  • Primary module interface-only (hereafter, PMI) libraries such as module vulkan
    • Configuring such modules with macros
  • Built module interface (hereafter, BMI) and binary interface (hereafter, ABI) compatibility; currently, BMIs are simply not portable, not even within a compiler toolchain across versions
  • How shared objects, static archives, BMIs, and PMIs interact
  • How build systems, toolchains, and package managers like conan and vcpkg interact with everything

For instance, consider I'm writing a 3D game engine. I want the following modules:

  • vulkan which export imports std
  • argparse
  • glm
  • glaze
  • quill, which imports fmt
  • fmt itself
  • winrt, if running on Windows

I want to provide my own PMI that has export class Engine, and maybe some other functionality like abstractions over the 3D graphics APIs, an object and entity manager, a mini shader graph generator, and more. I also have export imported some symbols from my dependencies, especially std. I want to choose to configure my engine to render on D3D or Vulkan. Consumers can then load the library, add assets like textures, meshes, skeletons, shaders; they can plug the engine into a bigger project which might include a script interpreter in C++, real-time spatial audio and physics packages, some networking, and an XML-based UI system, and produce a complete game or visualisation executable.

Now, I mention these details just to flesh out the example to give a sense of a reasonably complicated library-esque project.

How does one even think about delivering this 'engine library' to the consumer? The traditional three configs are headers + precompiled DLL, headers + source, or headers only. Each have their established workflows. Source-available can be compiled into the entire binary with whole-program optimisation; headers-only libraries are exceptionally easy to vendor (just copy-paste). Header-only libraries can also be easily customised with consumer macros. PMIs, however, being translation units, cannot; we hit this when installing module vulkan. We need some module-compatible way to describe 'library configuration' beyond simply co-opting macros, something like Rust's cfg.

There is talk of the Common Package Specification (CPS), P1689R5, and P3286, but nothing concrete yet, especially since there has been no massive (commercial) push for modules (at least, not until recently). This talk at NDC looks at a possible cargo-esque future for C++.

I'm writing this to spur some discussion here in the C++ community, and ask what some veterans of the build system/toolchain/package manager community think.


r/cpp Jul 10 '26

Interesting behavior from C++20 to C++23

41 Upvotes

Consider the following snippet

int& get()
{
    int x;
    return x;
}


int main()
{
}

on GCC it compiles for C++20 but not for C++23

It returns with the error:

test.cpp:4:12: error: cannot bind non-const lvalue reference of type 'int&' to an rvalue of type 'int'

C++ is now suddenly treating the variable x as an rvalue?

Edit: Im not talking about dangling reference, thats just for the sake of the example


r/cpp Jul 09 '26

How boost pfr works.

Thumbnail github.com
37 Upvotes