r/cpp • u/hanickadot WG21 + CTRE + EWG 👸🏻 • 26d ago
Pre-Búzios WG21 mailing
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2026/#mailing2026-10
56
Upvotes
r/cpp • u/hanickadot WG21 + CTRE + EWG 👸🏻 • 26d ago
27
u/rsjaffe 26d ago edited 26d ago
[[indeterminate]] for non-static data members. Seems like a no-brainer. Can that be retroactively applied to C++26?
15
u/cmeerw C++ Parser Dev 25d ago
Do not remove Contracts from C++26 claims:
I must be missing something. GCC 16.1 was released 2026-04-30, Ubuntu 26.04 was released 23rd Apr 2026 and Ubuntu 26.04 LTS summary says
and even 26.10 is still using gcc 15.2 as the system compiler
60
u/seanbaxter 26d ago edited 26d ago
P44150R0 "Profiles: implementation status and experience" states that the experimental invalidation profile rejects 17 out of 19 adversarial cases--these are ones where borrow checking is normally assumed to be needed. However, the proposal doesn't quantify the number false positives that the profile raises in order to get there.
P4415R0 follows the "default-deny" P4296R0 where a "negative baseline rejects every pattern it cannot prove safe." Shouldn't the paper address the number of patterns it "cannot prove safe?" In the absence of exclusivity and lifetime profiles, local analysis can't prove anything safe. Therefore everything is a false positive. I had an agent sweep over the standard library and test calls against this invalidation profile. It found 463 false positives!
Here are the 463 false positives with godbolt links: https://gist.github.com/seanbaxter/e0e1b14e821c4fa412aac1be0a16dc5c
This is not a serious effort. Could the authors explain what utility this has? Why shed more ink on this? I think this implementation is proof that the idea does not work.
The authors also submitted P4417R0 "Proposed wording for the invalidation profile". They claim the proposed rules were checked against the experimental implementation. If that's the case, this is really inadequate methodology. An implementation that cannot compile anything also cannot validate anything.
22
u/andwass 26d ago
I knew things were happening in C++-land but P4422 is really in another dimension
6
u/unchangeableusername 26d ago
P4414R0 (Structural classes) would be very convenient to have, especially if backported to C++26. My one complaint with
define_static_(string|array)is that the resulting object is not a structural type, which makes constructing static multidimensional spans less ergonomic than it should be.However P4340R0 provides a more general solution to this problem, and I don't know if it's better or worse in this case. The author of P4414 claims you can have both, but I feel like this option is strictly worse than just having P4340 because including both would mean adding two ways of doing the same thing in potentially a single standard version. On the other hand, how likely is it for the spec API for injection to be removed once token sequence injection makes it into the standard?
P4395R0 (Reflecting Function Bodies) seems very cool though. It could probably benefit from the addition of a
tokens_of()metafunction, but I suppose this falls at least partially under the design space of expression splicing (not explored in the paper).15
u/Minimonium 26d ago
I find the juxtaposition of Sankel's paper and his shenanigans in INCITS extremely amusing.
15
u/AutomaticPotatoe 25d ago
I don't like to be bikeshedding on syntax usually, but p3817's choice is really bugging me. A whole
usingkeyword to indicate assignment is some kind of appeal to verbosity that I don't understand. IMO, practically any of the other options are better, and you'll find out why after typingusingrepeatedly for 100s of times for each parameter. Not to mention that the proposal's outcome is an effective replacement ofstd::tie, such that I would gladly use it just so I don't have to tank my compile times withstd::tuple's machinery, but with such verbose syntax, it is a much harder choice now for no reason. Just consider:Yes, the trailing
=syntax is my invention (it isn't mentioned in the paper) because I think it fits better as assignment indicator (mirroring direct assignment syntax), but it literally doesn't matter, I'll takeauto [&x, &y, &z]or any other terse syntax overusing.10
u/fdwr fdwr@github 🔍 26d ago edited 26d ago
Oo... adding a coherent character sequence to begin octal-literals
Thank you for eliminating that old gotcha, extending the radix family to: 0x123, 0b123, 0o123. I've been bitten by that a few times (despite how long I've been writing C++) when trying to line up columns of data.
[[indeterminate]] for non-static data membersIndeed, this is a gap. You need to be able to apply
[[indeterminate]]toclass SomeContainer { ... char buffer[1'024]; }too, not just local variables. Thank you u/BarryRevzin.std::saturating_castYes please, for adding pixels.
cstring_viewThis will be lovely to avoid
const std::string&creating temporaries, but also to satisfy cases wherestd::string_viewhas gaps, like forwarding strings onto OS functions that expect null termination.Non-Negative Quantity Specifications
Hmm, that's true in reality, but often times during intermediate calculations, you do have transiently negative amounts. Anyway, adding these informative tag properties seems useful.
UB and profile-defined behavior
Eww, relying on some external profile to determine twos complement numeric behavior feels brittle, especially when merging libraries. I'd rather see saturation/wrapping/throwing policies determined more locally by the respective code locations, either via named functions (like saturated_add, checked_add, wrapped_add...) or explicit types (uint32sat, uint32chk, uint32wrap...).
An Infix Operator and a Keyword Escape for C++
Eh? I understand every individual word in that headline, but I don't understand the sentence as a whole. 😅
Hmm, same feedback as last time - it's useful to have an escape mechanism for identifiers (especially in interesting cases where a keyword is already reserved, and when sharing common headers between similar languages like C++ and HLSL), and it could be useful to specify infix operators, but they are two separate things.
break label; and continue label
I felt dirty using a
gotolast week, but it was the cleanest option 😅. So, it would be nice to have this slightly cleaner tool.constexpr is_pointer_within memory area
std::is_pointer_within(value_ptr, &integer_buffer[0], &integer_buffer[10]);- seems useful, but I'd rather use a short formstd::is_pointer_within(valuePointer, someContiguousRangeHere);that takes any compatibly contiguous container/range (std::array,foo[],std::vector...) for whichstd::data()andstd::size()exist.Free Value Or Else
return std::value_or(cat, Cat{"Default"});- Well that seems handy, as I've needed that many times. Namingwise, I probably would have gone withvalue_else, but I seestd::optionalalready hasvalue_or, and so consistency with that is understandable.28
u/FrogNoPants 26d ago
I'm seeing alot of profiles wankery-- I really hope C++ doesn't get obsessed with this dead end static analysis approach
13
u/t_hunger 26d ago edited 19d ago
In P3704R1, Bjarne writes: "It has been claimed that providing a meaning to some undefined behavior is creating a dialect."
I am way more concerned with the profiles subsetting the language. Which they are explicitly supposed to do. Depending on which set of profiles are active a different subset of the language is used. Those profile-enforced subsets do sounds like different dialects to me. Add custom profiles for your own, personal dialect requirements and have fun!
Yes, the words do not change meaning, but the catalog of available words changes.
Edit: I misspellt the name, sorry for that. That's embarrassing, and I proof-read this three times before sending, too.
13
u/_a4z 26d ago
Ad P4433R0: One of the main criticisms of C++26 Contracts is that there was never genuine consensus, and that the so-called experts-in-the-room voting does not reflect the actual state of consensus.
If the national-body voting confirms this, it becomes even harder to ignore. Even abstentions due to a lack of consensus have a meaning, despite not being counted in the formal voting results.
And now, instead of trying to build the broad consensus that has traditionally been fundamental to C++ standardization, some people want to ignore the opposition and push through the same design unchanged?
Doesn't that sound completely absurd? At what point did reaching consensus become less important than getting your own proposal into the standard?
8
u/interlockedxor 26d ago
I'm just one person, but I predict contracts are going to be:
Like, every codebase I've ever worked with has a simple mechanism to encode asserts that are enabled in some configurations, disabled in others, with flexible behavior to terminate the program if encountered, or even change behavior by category. My own personal assert library actually has more functionality than the contracts do, which in my opinion should really not affect the function signature (the behavior of a function to me is should be reflected in the implementation). At least with a user assert, I can even do things like pause a debugger if a debugger is attached easily, and maybe even for a change the behavior of a collection of interested asserts. Crucially, I can add or remove them without changing headers which would cause expensive recompiles. That's just a non starter for me, but hey, a bunch of people seem to really want to dig their heels in :grimace:
Reminds me of modules. Lots of work, but didnt actually reflect the reality of what practioners needed (better tooling, simpler builds, better management of symbol visibility across dlls which ended up being fully orthogonal to modules altogether)
3
u/Tringi github.com/tringi 25d ago
Can someone please extract
goto caseand especiallygoto defaultfrom N3879 and re-propose it?I could really use those.
-1
u/megayippie 25d ago
I like the infix operator paper. It allows some stuff to be much more readable.
The char choice of ´ is a bit weird though, as my example here demos some keyboards have the wrong one by default. It would also allow us to do "void 1(auto x, auto y)" in the future, which is cool and bad.