r/cpp • u/claimred • Apr 20 '26
Software taketh away faster than hardware giveth: Why C++ programmers keep growing fast despite competition, safety, and AI
herbsutter.comRefreshing take by Herb. Slides here
r/cpp • u/claimred • Apr 20 '26
Refreshing take by Herb. Slides here
r/cpp • u/ProgrammingArchive • Apr 20 '26
CppCon
2026-04-13 - 2026-04-19
2026-04-06 - 2026-04-12
2026-03-30 - 2026-04-05
C++Online
2026-04-13 - 2026-04-19
2026-04-06 - 2026-04-12
2026-03-30 - 2026-04-05
ADC
2026-04-13 - 2026-04-19
2026-04-06 - 2026-04-12
2026-03-30 - 2026-04-05
Meeting C++
2026-04-06 - 2026-04-12
2026-03-30 - 2026-04-05
using std::cpp
2026-03-30 - 2026-04-05
r/cpp • u/KijoSenzo • Apr 20 '26
I know Python and have been binging C++ for a couple of days now from scratch. C++ feels like a language where you gradually discover a huge checklist of "STATE YOUR INTENT" due to years of probably layering on things to shore up its weaknesses of memory/type safety etc. Like I get it, it's how C++ was designed for things to be explicit and it's like the English language where you don't need to know every word and in this case, feature, but every line of code makes me feel I'm asking a gajillion questions.
So far I have jotted down some stuff that took me awhile to digest...
So I guess I'm not very familiar with the ecosystem or ever worked with other C++ code. Like is this good or bad? I would think it's very safe but do and should people code actually C++ like this? I don't have a frame of reference to relate to and I don't know if the C++ community is going to jump on things like C++26's contracts or reject it. What's the current attitude? If you were a teammate, would you love or hate to see something like this?
[[nodiscard]] constexpr std::expected<int, Error> GetHP(const std::unique_ptr<Player>& player)
{
assert(player);
if (!player) return std::unexpected(Error::NullPlayer);
const auto [hp, alive] = std::pair{player->hp, player->hp > 0};
static_assert(sizeof(int) == 4);
return alive ? hp : 0;
}r/cpp • u/mateusz_pusz • Apr 20 '26
Integers overflow. That is not a controversial statement. What is surprising is how easily overflow can hide behind the abstraction of a units library.
Most developers immediately think of explicit or implicit scaling operations — calling .in(unit) to convert a quantity, constructing a quantity from a different unit, or assigning between quantities with different units. These are indeed places where overflow can occur, and the library cannot prevent it at compile time when the values are only known at runtime. But at least these operations are visible in your code: you wrote the conversion, you asked for the scaling, and you can reason about whether the multiplication or division might overflow your integer type.
The far more insidious problem is what happens when you don't ask for a conversion.
When you write 1 * m + 1 * ft, the library must automatically convert both operands to a common unit before performing the addition. That conversion — which you never explicitly requested — involves multiplication or division by scaling factors. With integer representations, those scaling operations can overflow silently, producing garbage results that propagate through your calculations undetected.
No compile-time programming can prevent this. The values are only known at runtime. But very few libraries provide proper tools to detect it.
This article explains why that limitation is real, how other libraries have tried to work around it, and what mp-units provides to close the gap as tightly as the language allows.
r/cpp • u/tartaruga232 • Apr 20 '26
I assume Gaby meant that the design of module partitions could be changed, such that the syntax:
// Translation unit #1 (C++29?)
module M:P; // Note: partition P is an external partition of M
...would mean, that in such a TU #1 we could define functions of the module M.
:P.That is, it would be ok to write:
// Translation unit #1 (C++29?)
module M:P;
...
// Translation unit #2 (C++29?)
module M:P;
...TU's #1 and #2 could not be imported (and don't need producing a BMI). That is, they do not introduce a named partition.
These would basically be "unnamed partitions" for implementing modules. They would be analogous to the current "module M;".
Can we go back to the drawing board about partitions?
I think we are going in circles with the idea of anonymous partitions by u/not_a_novel_account.
If we could redefine the syntax "module M:P;" that would solve the problem of unwanted module dependencies. Which is, per the current standard, if I write:
// Translation unit #3 (C++20)
module M; // implicitly imports M
import :P;
...I get :P twice plus the rest of the interface of M (which I don't need in TU #3).
Implications:
(A) We would have to rewrite existing code
// Translation unit #4a (C++20)
module M:P;
...to
// Translation unit #4b (C++29?)
export module M:P;
...and (B) remove the requirement in the current standard that TU #4b must be exported from the primary module interface unit (PMIU), if and only if nothing from TU #4b is exported.
I'm addicted to modules and I won't go back to using header files, but I think the current design of partitions in the standard is a real mess (sorry).
Thoughts?
r/cpp • u/Sea-Log-8341 • Apr 18 '26
What do you guys think about the book Introducing C++: The Easy Way to Start Learning Modern C++ by Frances Buontempo i was considering to buy it because i want to learn c++ and i already have some experiences coding in other languages it seems like a sort of successor to accellerated c++
r/cpp • u/tartaruga232 • Apr 19 '26
What is the reason for implicitly importing the interface of the module when implementing the functions of an internal partition?
r/cpp • u/meetingcpp • Apr 18 '26
I just clicked a link that wasn’t cached and noticed very long loading time. Eventually the page loaded, and I noticed the font was different. After Herb’s post, I was excited and noticed the homepage notice declared the site newly operational again! However I am experiencing a significant number of 5xx errors.
r/cpp • u/Embarrassed_One4431 • Apr 17 '26
r/cpp • u/tartaruga232 • Apr 17 '26
Quick question for those who currently use modules with partitions.
That is, for a module like the one below (our file Core/_Module.ixx):
export module Core;
export import :Attach;
export import :Base;
export import :Container;
export import :Diagram;
export import :Interfaces;
export import :Transaction;
export import :View;How did you implement your code?
What we did:
We have done it as I've described in my blog posting "How a Module Should Look", which is for example for our file Core/Transaction/FinalizerDock.cpp:
module Core;
import :Transaction;
...which contains function definitions for declarations in the partition Core/Transaction/Transaction.ixx:
export module Core:Transaction;
...Please tell me what you did. I'm really curious.
Thanks in advance for the responses!
r/cpp • u/Xaneris47 • Apr 17 '26
Developers from PVS-Studio are continuing their series of talks about creating a custom programming language. They will explain what the lexer is, what it consists of, and how to work with it.
The talk series as a whole is for devs who want to start understanding how compilers work under the hood. Throughout the series, their C++ architect demonstrates the practical application of each programming language component.
If you're interested, I leave the link here.
r/cpp • u/DarkCisum • Apr 16 '26
It's minor version, but with major features.
r/cpp • u/emilios_tassios • Apr 17 '26
HPX is a general-purpose parallel C++ runtime system for applications of any scale. It implements all of the related facilities as defined by the C++23 Standard. As of this writing, HPX provides the only widely available open-source implementation of the new C++17, C++20, and C++23 parallel algorithms, including a full set of parallel range-based algorithms. Additionally, HPX implements functionalities proposed as part of the ongoing C++ standardization process, such as large parts of the features related parallelism and concurrency as specified by the C++23 Standard, the C++ Concurrency TS, Parallelism TS V2, data-parallel algorithms, executors, and many more. It also extends the existing C++ Standard APIs to the distributed case (e.g., compute clusters) and for heterogeneous systems (e.g., GPUs).
HPX seamlessly enables a new Asynchronous C++ Standard Programming Model that tends to improve the parallel efficiency of our applications and helps reducing complexities usually associated with parallelism and concurrency.
In this video, we explore how to perform deep runtime analysis on HPX applications using APEX and the Traveller visualization tool, detailing how visualizing OTF2 traces helps distinguish between true application performance and redundant computation where raw hardware utilization metrics often prove deceptive. We focus on the configuration of HPX with APEX and the bundling of raw trace files, demonstrating the interpretation of profiling data through a practical comparison of unoptimized odd-even transposition and native HPX parallel sorting algorithms. The tutorial details the process of diagnosing misleading "busy full" scenarios, utilizing Traveller's interactive web panels—including utilization views, interval histograms, and dependency trees—to uncover inefficient task structures and visualize recursive fork-join patterns, ensuring that applications are delivering true algorithmic efficiency rather than just keeping cores busy. This provides a clear introduction to evaluating HPX's lightweight task management, culminating in actionable insights, where we illustrate how to resolve performance flaws and harness the full potential of modern parallel hardware.
If you want to keep up with more news from the Stellar group and watch the lectures of Parallel C++ for Scientific Applications and these tutorials a week earlier please follow our page on LinkedIn https://www.linkedin.com/company/ste-ar-group/ .
Also, you can find our GitHub page below:
https://github.com/STEllAR-GROUP/hpx
https://github.com/STEllAR-GROUP/HPX_Tutorials_Code
r/cpp • u/madnirua • Apr 16 '26
r/cpp • u/Krystian-Piekos • Apr 16 '26
How to apply annotations for better generic hash implementation in C++26.
r/cpp • u/marcoarena • Apr 16 '26
Hi everyone!
I am organizing a special meetup with Bjarne Stroustrup in Florence on Saturday, May 9!
Schedule:
The event will take place at the University of Florence (Novoli Campus) and is organized by the Italian C++ Community, the University of Florence, and the University of Pisa.
For developers traveling from abroad, this is also a great excuse to visit Florence, while connecting with the Italian C++ community.
Free registration and details:
https://italiancpp-fi26.eventbrite.it/
Looking forward to seeing you there!
This is not my post, but I didn't see anyone share this here yet.
r/cpp • u/igaztanaga • Apr 16 '26
Announced officially in the Boost developer mailing list:
Introduction
The formal review of Joaquín M López Muñoz's boost::container::hub container, for inclusion in the Boost.Container library, starts today.
hub is a sequence container with O(1) insertion and erasure and element stability with great performance (see these benchmarks): pointers/iterators to an element remain valid as long as the element is not erased. hub is very similar but not entirely equivalent to C++26 std::hive (hence the different naming, consult the section "Comparison with std::hive" for details).
It may be downloaded from:
https://github.com/joaquintides/hub
the documentation may be found here:
https://github.com/joaquintides/hub/blob/develop/README.md
Anyone is welcome to post a review and/or take part in subsequent discussions in the mailing list.
Review guidelines
Please provide feedback on the following general topics:
Ensure to explicitly include with your review: ACCEPT, REJECT, or CONDITIONAL ACCEPT (with acceptance conditions).
Ion Gaztañaga (Review Manager)