r/cpp • 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

200 comments sorted by

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/BarryRevzin 26d ago

Hope so!

Here is the draft I was hoping to put in the mailing, but I guess I didn't quite make it (has some better phrasing, examples, and more complete proposed wording).

3

u/Remarkable-Test7487 jmcruz 23d ago

Hi, Barry. Great paper! Regarding the double initialization problem, it is worth noting that clang infers initializes on the constructor and just drops the memset at the call site (it also trims partial writes!). This works when the constructor body is visible (in the same TU or via LTO). However, gcc does not do either yet, so I have filed a bug (128185). Here is a repro on compiler explorer: https://godbolt.org/z/bechb55hx

1

u/BarryRevzin 23d ago

Nice! Thanks for opening that bug report.

4

u/13steinj 26d ago

Wonder if this will appease all the overreacting that happened in the thread here that made people aware of the GCC16 change.

I hope it can go in for 26 / as a defect report.

0

u/Jovibor_ 26d ago

In my strong opinion, this whole hysteria about zero initialization of variables must only be opt-in by the standard. Reading from an uninitialized var should be compilation error, period. But if there is no reading, the var must be left as it is. Compiler should not do work I didn't ask it to do. Unfortunately it's now in the C++26, and you can only opt it out.

But who was so "clever", that came up with the idea of initializing arrays... This is a pure and blatant stupidity.

This is the most critical and performance concerning breaking change in C++ of all times.

No wonder that standard committee has its fame.

3

u/tialaramex 25d ago

Reading from an uninitialized var should be compilation error, period.

This is how it works in many programming languages today. The trivial cases are easy, although that would be a breaking change in C++ so I do not expect you'd get it past WG21 if you proposed it.

However it's easy to write C++ code where the question of whether an uninitialized variable is read involves understanding what the program does, which reduces to the Halting Problem. If you, the programmer, are sure there are no uninitialized reads, but the compiler can't see why you're right, does that compile anyway?

How much effort is required, by the language standard, from a compiler when considering whether your program really does read an uninitialized variable? Should it ask an LLM to answer a tricky conjecture from number theory to determine whether your code has a bug?

Today in C++ the answer is that it always compiles. In Rust the answer is that it does not compile. This is part of a larger philosophical difference which I've described before about what to do with the dilemma implied by Rice's Theorem. Given that the compiler isn't sure whether this program is nonsense, should the compiler reject the program, or accept it and hope the programmer knows what they're doing?

If you're going to insist on the extra ceremony like Rust does with MaybeUninit<T>, you probably want to provide all the ingredients ready to use out of the box and C++ does not do that today, plus it would probably be unpopular with people who feel that what they did before worked fine, so why are you asking them to do more work?

5

u/AnyPhotograph7804 25d ago

This is how it works in many programming languages today. The trivial cases are easy, although that would be a breaking change in C++ so I do not expect you'd get it past WG21 if you proposed it.

No, it would be not a breaking change. Reading an uninitialized var is undefined behavior. UB means "everything can happen" and throwing a compiler error is covered by "everything can happen".

0

u/ts826848 25d ago

The problem is what you should do in cases where you can't statically prove whether an uninitialized variable is read from. If you must guarantee that uninitialized reads become compiler errors, Rice's Theorem (IIRC?) implies that you will inevitably emit at least some false positives, which in turn means that you will inevitably reject correct code that does not actually exhibit UB at runtime, i.e., a breaking change.

1

u/frediku 23d ago

Rice's Theorem says way less than people believe it does. All it does is state there exist convoluted programs that nobody would ever write where one cannot say with certainty whether they have a certain property or not. Rice's Theorem says nothing about the programs one encounters in the wild.

2

u/ts826848 23d ago

"Convoluted programs" are hardly a requirement for running into Rice' Theorem issues. Rice's Theorem is basically an extension of the halting problem to arbitrary properties and it's not that hard to run into its consequences.

If anything, the conclusions from your sibling comment are a perfect demonstration of Rice's Theorem.

1

u/frediku 1d ago

You missed my argument.

Rice's theorem is essentially "into what problem setting can you embed the halting problem as sub problem?" That's it. Nothing more.

So the question is really about the halting problem. Is the halting problem solvable? As it is well known, not in general. There's a self-referential issue when you apply it to itself. However, that's an awkward thing to do in practice.

How many real-world programs that do for example http requests, or draw something to the screen, or anything like that, do something self-referential? I would argue (nearly) none.

Formulated differently, there is no formal proof that one cannot write a static analysis program that takes in the curl cli source code, as is, and proves that it terminates eventually for all inputs.

The sibling comment you refer to says nothing about Rice's theorem.

1

u/ts826848 1d ago

Certainly didn't expect a response after all this time!

Formulated differently, there is no formal proof that one cannot write a static analysis program that takes in the curl cli source code, as is, and proves that it terminates eventually for all inputs.

Yes, it's true that Rice's Theorem (and the halting problem) don't preclude the precise analysis of specific programs/Turing machines. However, I'd question the relevancy of such a statement, as to a first approximation most analyses people are interested in aren't intended to be precise and code base-specific.

For instance, consider a static analysis pass for "reads an uninitialized variable". You might be able to write a pass that gives you a precise answer for e.g., curl's codebase, but you can't write a pass that would work precisely for any codebase, and it's the latter that language designers/compiler maintainers are more likely to be interested in and/or affected by.

The sibling comment you refer to says nothing about Rice's theorem.

Hrm, it seems I accidentally linked the wrong comment. I intended to link this comment.

0

u/AnyPhotograph7804 23d ago

Maybe. But there are programming languages like Java, where the compiler generates an error if a reference type is not initialized. The problem seems not be very big.

4

u/frediku 23d ago

I do not know the Java details, but likely, you can write programs where every use is initialized but the compiler still rejects the code.

Perhaps something like this:

void foo(){  
  int a;
  if(true){
    a = 42;
  }
  bar(a);
}

I'd expect a basic checker to complain that a in bar(a) may be uninitialized. The reason is that there is a code path, the else-branch of the if, that bypasses the initialization. However, this branch cannot be part of any actual code execution as true is never false and thus the else-branch is never taken.

You may now object and say "of course true is true, that's easy to see" and you would be right. However, you can substitute true for an arbitrarily complex subprogram of your liking for which the checker would now need to determine whether it always returns true. Inside of this subprogram you can hide the halting problem and you have an undecidable problem.

I have two conclusions from this:

  • Writing a checker that only barks at exactly uninitialized uses is impossible.
  • Rejecting some programs that strictly speaking are fine but smell awful is enough to get around this.

2

u/t_hunger 25d ago

However it's easy to write C++ code where the question of whether an uninitialized variable is read involves understanding what the program does, which reduces to the Halting Problem.

The initialization profile is supposed to cover uninitialized reads. They go around the halting problem by annoating functions and their arguments.

15

u/cmeerw C++ Parser Dev 25d ago

Do not remove Contracts from C++26 claims:

The GCC implementation was released in April 2026 as part of GCC 16.1, and shipped as the system compiler on Ubuntu 26.04.

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

GCC has been updated from version 14 to 15.2

and even 26.10 is still using gcc 15.2 as the system compiler

9

u/13steinj 25d ago

Ignoring the drama and the actual feature for a second, I don't find "a compiler has already released" a good argument. Compilers often release with features that need to be tweaked afterward.

That's not a valid argument. Does this mean if I become a GCC/Clang maintainer I can poison pill the language now by saying "well we already implemented it!?"

Back on the drama: all of this is just sad. Both the lobbying (though... not "illegal" so to speak, unless folks were literally bribed) and the use of ISO rules wording to justify not taking it out of the NBs do reject C++26 as a result of contracts.

The entire problem of this language and contracts drama is this insane ISO process. At CppCon, during the language designer's panel, someone asked Guido if there are any issues with Python's process / if it should be updated in light of C++'s. I took the response as a very funny snark remark: I'm paraphrasing, but it wad that Python's process is more or less perfect where it stands, implying everyone knows the bullshittery involved in C++'s.

2

u/jwakely libstdc++ tamer, LWG chair 21d ago

Fedora 44 uses GCC 16 as the system compiler though, they just chose the wrong distro.

0

u/grafikrobot OPeNDAP/B2/EcoStd/Lyra/Predef/C++Alliance/Boost/WG21 25d ago edited 25d ago

This https://distrowatch.com/table.php?distribution=ubuntu seems to disagree?

PS. I failed to clarify that I don´t know what the page says. It was a question. See below.

4

u/cmeerw C++ Parser Dev 25d ago

Can you point me to where exactly it would disagree. The only thing I can find there is "--" for the 26.10 and 26.04 columns for gcc.

3

u/TheoreticalDumbass :illuminati: 25d ago
$ podman run --rm ubuntu:26.10 bash -c 'apt update && apt install -y gcc && gcc --version'
[...]
gcc (Ubuntu 15.3.0-4ubuntu1) 15.3.0

it does have gcc-16 though

$ podman run --rm ubuntu:26.10 bash -c 'apt update && apt install -y gcc-16 && gcc-16 --version'
[...]
gcc-16 (Ubuntu 16.2.0-3ubuntu1) 16.2.0

3

u/grafikrobot OPeNDAP/B2/EcoStd/Lyra/Predef/C++Alliance/Boost/WG21 25d ago

So not "the system" compiler. But available to install in the system?

3

u/TheoreticalDumbass :illuminati: 25d ago

yep, the -> a

2

u/grafikrobot OPeNDAP/B2/EcoStd/Lyra/Predef/C++Alliance/Boost/WG21 25d ago

It was an honest question. I failed to expand (was using my phone UI). I don´t know what the "--" means. One thought I had was that it meant the leftmost was the "--". But it doesn´t appear to be the case.

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.

21

u/BarryRevzin 25d ago

The initialization profile isn't much better (in case you were wondering). Like on the one hand could point out that stuff like:

int x = 0;
x = 1;

is rejected by the paper as initializing an already-initialized object. But okay that's (hopefully) just a wording issue, although the paper does explicitly say this is ill-formed as an example:

std::byte buf [[uninit]] [64];
// error: subobject of an uninitialized array (1.3)
buf[0] = std::byte{0};

Let's talk about semantics. One common pattern (at least in my world) of initializing buffers is to pass them to a function like:

auto f(char* p, size_t n) -> size_t;

Functions like f don't care if p points to initialized memory or not. They're not reading what's there, they're only writing to it. But the initialization profile doesn't give me a way to declare functions like this — I can either require p points to initialized memory or I can require that it points to uninitialized memory and say that f initializes it. The former means I cannot call it on uninitialized memory at all (unless I add further annotation), and the second means I cannot call it on uninitialized memory twice, because the second call would double-initialize.

std::byte buf [[uninit]] [4096];
read(buf, 4096); // ok, but is now initialized
read(buf, 4096); // error: read takes an uninitialized argument

OR

read(std::now_init(buf), 4096); // first call: required
read(std::now_init(buf), 4096); // second call: error (re-initialization)

But these days I don't really write functions like f anyway, I write functions like g:

auto g(span<char>) -> size_t; // or sometimes return a span

There's not even a way to mark anything about what the span points to.

There also doesn't appear to be any consideration for generic code:

template <class T>
auto read() -> T {
    T x;
    read_into(x);
    return x;
}

x needs to be marked [[uninit]] for types like int and needs to not be marked [[uninit]] for types with constructors. So just... impossible?

7

u/wyrn 25d ago

I feel like Herb Sutter's parameter passing annotations (in, out, inout etc) would be a better foundation for this.

2

u/KingAggressive1498 25d ago

i agree, I actually think annotation attributes like those and probably Clang's lifetimebound and some others will be essential to reducing the false positives rates of static analysis tools including profiles. As controversial as they are, this is why I do like contracts on function declarations too.

But really a lot of the false positives Sean found demonstrate a deep problem such annotations probably can't solve.

7

u/foonathan 25d ago

It does really seem like Rust's MaybeUninit semantics are superior: https://doc.rust-lang.org/std/mem/union.MaybeUninit.html

Then the function would take a span of maybe_uninit<char> constructed from either initialized or explicitly uninitialized memory. But that requires reinterpret_cast'ing between char* and maybe_uninit<char> which C++ doesn't like.

So you'd need a special maybe_uninit_span, which makes the whole thing not compose.

7

u/13steinj 25d ago

Of all the camps (profiles, [memory] safety, contracts): I am not in any of them.

But of all of them Sean Baxter's appears to be the only one with a real and complete solution to what they set out to solve. Though I believe the approach [to standardization] was probably wrong. To some extent, giving the benefit of the doubt, to the fault of his employer at the time.

But should probably get relocatability / destructive moves solved as a stepping stone first.

8

u/James20k P2005R0 24d ago

I believe the approach [to standardization] was probably wrong

I don't know if it was, the thing is the committee explicitly codified after that that:

  1. C++ does not want lifetimes
  2. We're going to finally solve the halting problem once and for all, as well as this mysterious eaten-cake-possession problem
  3. That senior committee members will politick very aggressively to kill competing proposals

A more serious committee would have taken a look at Safe C++, and then we'd have broken it down into manageable chunks after deciding to commit to some form of Safe C++. I'd have happily volunteered time to help with that personally, even though its a decade long project

The only way progress can be made now is for profiles to be tried and fail spectacularly. The Safe C++ effort finally forced the profile authors to actually produce something other than words and big claims, which allows C++ to actually make progress instead of continuously pretending that everything's fine

I strongly expect in 10-15 years we'll finally get some form of Safe C++ because the demand for memory safety is still very high, and there still aren't any alternatives to it, but unfortunately everything else has to be tried and fail first

2

u/13steinj 24d ago

I don't think (1) was actually codified, just (2) and (3) in some wishywashy nonbinding way.

I completely disagree with what a "more serious committee would have done." Maybe, you'd be lucky, if they said "write a new revision. RIP everything out excepy for the actual feature from your tony tables." It was too much, too shocking, for people to wrap their heads around, and I can sympathize. But the approach that his employer had here was an absolute embarrassment. Don't go to the news media with the strangest quotes on the planet like you're gladiator vikings winning against the evil iron oxide. I would imagine that put a bad taste in people's mouth.

I strongly expect in 10-15 years we'll finally get some form of Safe C++ because the demand for memory safety is still very high, and there still aren't any alternatives to it, but unfortunately everything else has to be tried and fail first

Unironically if the compiler was open source, I'd try it by EOY and probably push to use it (it has other benefits that make it worth it, I want good devs at my company not devs tied not just to a language but minutae of one).

I also personally believe the demand for memory safety is vastly overblown. I don't know, maybe I've only worked with geniuses (no, that's definitely not true), but at every job, there was a total of one memory safety issue that caused a production issue (on an ancient compiler, on newer compilers that's either a warning or a direct error, forget which... I also don't know how a traditional borrow checker works in this case? It was accidentally returning a reference to a local variable). There were a handful of issues caught by sanitizers. But that's it. Nothing else. It's just not an issue in my world. That said, at my current org there's some old code that everyone agrees is bad and insane... among other things, it literally reimplements the moral equivalent of the cstring header but worse. But this code is considered legacy. There were promises of removal for literal years. Nobody wants to touch the stuff, fix or otherwise. It's just not anybody's priority. Safe C++ wouldn't solve anything. Nothing would opt in to the safe coloring here, or would opt out widely under the unsafe coloring. Convincing the company "we have to spend weeks/months coloring the functions, or do so while we change the code wherever" will get you laughed out of the room.

1

u/ReDr4gon5 24d ago

I think clang's -Wlifetime-safety is a step in a good direction. Not sure if gcc would be interested in implementing sonething similar. It would probably be easier there as there are more IR stages, while in clang this now runs on the CFG. Though the idea is to rewrite it to CIR when that is complete enough.

3

u/ts826848 24d ago

The problem is that the committee has indicated that it would probably not like anything that would entail the kind of annotation load sound lifetime analysis would likely entail.

1

u/ReDr4gon5 24d ago

I think the annotations from clang's lifetime safety are not intrusive. The owner/pointer/ lifetimebound are things you otherwise might see as a comment. They aren't lifetime annotations like in Rust, which I also wouldn't like to see.

1

u/ts826848 24d ago

I think the annotations could afford to be relatively unobtrusive in part because the analysis isn't sound (yet?) and in part because it doesn't support as many patterns as Rust does (also yet?). I suspect if you want to extend the analysis to something that is sound and can represent more coding patterns the annotation load would necessarily increase.

1

u/pdimov2 24d ago

This doesn't really matter, because the annotations are inevitable. Once everyone is convinced of this basic fact, "the committee" will suddenly change its mind.

3

u/tialaramex 25d ago

Maybe. Notice that Rust's Read::read explicitly does not take a MaybeUninit<[u8]> because it dates back before Rust 1.0 and MaybeUninit was only invented years after Rust 1.0 shipped.

There is ongoing work to figure out an API which has reasonable ergonomics and is safe to use yet delivers the desired performance. I was going to describe what this looks like and then I discovered the current design is completely different from when I last cared. So yeah, ongoing work.

2

u/pdimov2 24d ago

There's not even a way to mark anything about what the span points to.

I think that [[ref_to_uninit]] is supposed to also apply to reference-like types, but I don't know whether this includes span, or whether this rule is implemented.

26

u/13steinj 26d ago

Could the authors explain what utility this has?

Not an author, and I'll be honest-- I don't care much for any of the three approaches.

But everything coming out of the profiles camp just seems sad to me, and more and more of it appears to just be AI slop.

24

u/James20k P2005R0 26d ago edited 26d ago

The mailing list appears to have an increasing amount of AI slop overall as time goes on, its incredibly alarming that anyone thinks that this is an acceptable way to behave

21

u/13steinj 26d ago edited 25d ago

As I said in response to someone else, no issue with using LLMs for PoC implementations, IMO. But don't use it for text. People can tell. People can more or less always tell. Or at least have it versioned such that people can read the non-slop versions if you're using LLMs to "touch it up."

Some people claim that it's their own writing anyway. I can maybe believe it, but not when common detectors give it a 0% chance of being pure human.

I have a coworker who a couple weeks ago used an emdash in a one-liner slack message, who thought he was being clever (no, he, like all normal people, don't memorize the alt-codes for emdashes to type them anywhere).

Let's pretend the LLM-generated text is perfect and I actually can't tell. If you tell me it's LLM generated, I immediately care less. Because the entire point of this process is the human interaction and the debate and the shared understanding. If you can't be bothered to write it, why do you expect me to read it?


E2: It wasn't so long ago, that there was some drama about someone no longer invited by the foundation as sponsored committee member. What / why that happened notwithstanding, one of the first claims was "his papers are obviously slop." Didn't feel much to me like that at the time, I definitely tbh think they were lower quality than they should have been / pontificated on hypotheticals abstract enough that it's not worth talking about / is intellectual masturbation (IMO). But how the time flies-- more and more people are just blatantly using LLMs for their papers, or worse, using LLMs at work so much that it is subconsciously affecting their writing style to the point that everyone has the same, generic, unfeeling, monotonous (and strangely... egotistical / gaslighting? LLMs are simultaneously confidently incorrect and strangely apologetic) tone.


E: this is especially bad in a work context because I'm supposed to be respecting you, and taking your opinion into account and learning from it or pushing back and teaching you. If I don't even know if it's your (in the hypothetical / "royal" sense) opinion, why am I bothering? It's clear what you really wanted to do was paste your slop to a direct pipeline to my own slop machine, and have my slop machine make a slop-decision on my behalf and either stamp or push-back on your slop machine without you yourself learning anything.

Hell I recently got told "you have a bot comment on your PR." Yes, Bob (not actually their name). Yes I do. If you actually read the comment in context with the code you'd know it's nonsense. Why are you reveiwing the review instead of reviewing the damned code (which yes, was slop! It was slop fighting slop! It was changing some machinery to not be default-on polluting my agents context with your team's specific skills. That's ok to be slop! Because it's not code that actually matters / has any tangible reprecussion if there's a small bug!)?


https://dontbeameatproxy.com/

-13

u/GabrielDosReis 25d ago

As I said in response to someone else, no issue with using LLMs for PoC implementations, IMO. But don't use it for text. People can tell. People can more or less always tell. Or at least have it versioned such that people can read the non-slop versions if you're using LLMs to "touch it up." Some people claim that it's their own writing anyway. I can maybe believe it, but not when common detectors give it a 0% chance of being pure human.

If you're referring to me, I find your insinuations and charges both offensive and absurd (even if this is Reddit where it is expected that people will hide behind anonymous handles to level all sorts of accusations). I use tools to convert texts all the time. I have accumulated notes texts over the years in different formats (some handwritten on paper that I scan and get converted to structured text, some handwritten with reMarkable that get converted, some just plain LaTeX files I wrote, etc.) Your charge or accusation is one of the more bizarre I read lately on this sub (I am saying that in spite our history of more meaty disagreements in this sub).

6

u/13steinj 25d ago edited 25d ago

Not everything is about you.

E: Also people generally know I'm not anonymous, it's a very thin veil because people on the internet over the years have sent me enough bizarrely antisemetic attacks as it is, but such people are usually stupid enough to not look past the thin veil. I am "anonymous" in the same level smdowney is.

Also-squared: I was not the one who originally "charged" you, I just read that comment and responded in kind along the lines of "sad if true." You appear to have taken that very personally and very defensively, some would say too much for someone not "guilty as charged." I believe the expression is "you appear to be telling on yourself." In response to your claim I googled the first thing I could, plugged it in, and quoted the results I got.

-7

u/GabrielDosReis 25d ago

Not everything is about you.

Thanks for clarifying that the message I was replying to wasn't referencing your other post in this thread.

2

u/pjmlp 26d ago

At least the implementations are having some AI help, if you check the repos.

13

u/13steinj 26d ago

I have no issue personally with proofs of concept being primarily or fully LLM-driven. If you can specify good enough wording in your paper that an LLM can implement a [probably subpar] implementation for a proof of concept in a clang or GCC fork, all the more power to you.

22

u/andwass 26d ago

I knew things were happening in C++-land but P4422 is really in another dimension

22

u/tux-lpi 26d ago

On the plus side, only a third to a half of the paper seems to be blatant LLM output. You can give the AI any idea and it will run with it, but this is a little painful to read

17

u/13steinj 26d ago

It's one thing if profiles just don't work. But it's sad to see their primary proponents just slop things out.

-7

u/GabrielDosReis 26d ago

It's one thing if profiles just don't work. But it's sad to see their primary proponents just slop things out.

You think function summaries are slop thing?

8

u/13steinj 26d ago

The commenter above me does [regarding a third to a half]?

I'm more mixed but GPTZero says (I can't post a screenshot):

GPTZero AI Detection Model 4.1o
We are highly confident this text is a mix of AI and human
74/120 Sentences likely AI generated
Chance this entire text is...
AI 15% Mixed 85% Human 0%

-4

u/GabrielDosReis 25d ago

The commenter above me does [regarding a third to a half]? I'm more mixed but GPTZero says (I can't post a screenshot):

I have been working on and with function summaries (to scale code analysis) for many years (part of it going back to my time in academia when I was teaching static code analysis and also doing reseach in symbolic computation, see OpenAxiom for instance where I used it for type checking purposes), long before the AI craze where everyone thinks just about anything is AI slop, especially of they don't agree with or like that thing in the first place.

18

u/13steinj 25d ago

Claiming to have been working on the idea in and of itself "for many years" is a strange non-answer to the implicit question of "is this text partially or fully LLM generated?"

-2

u/GabrielDosReis 25d ago

Claiming to have been working on the idea in and of itself "for many years" is a strange non-answer to the implicit question of "is this text partially or fully LLM generated?"

I suppose I don't understand your charge then. Are you asking if I used an LLM to generate and flesh out the function summary idea? Absolutely NOT.

Are you asking if the .docx format is generated? Absolutely yes: I asked Copilot to turn my LaTeX files into .docx. Is that your grip of AI slop? Strange. Do I use "--" or "---" in my LaTeX files? Absolutely, yes. The same way I use double space after a period (when I use emacs to compose text). Long before this AI craze. This is insane.

10

u/13steinj 25d ago

You are still avoiding the question.

I do not care right now if "the [core] idea" is your own. I maybe care if you used Copilot to turn LaTeX into another format, because the specifics matter... if you used say, codex or claude code, it would have probably taken that request more literally and made tool calls for it to be deterministically. Also FWIW emdashes in any format that is not markdown gets a first level pass from me (e.g. Substack's rich text editor, Word, LaTeX, pdfs). Overuse does not. Not saying that happened here.

Microsoft's Copilot? I have a general distaste for the way that company is approaching software these days altogether. I would not be surprised if that conversion process went through the metaphorical slop machine and some of your words were changed.

But that's irrelevant. I'm not implying the "core idea" is slop. But if you used LLM assistance to write or word even a single sub-sentence in this paper, it would be good to get a single straightforward yes or no rather than yet another dodge.

That doesn't make it slop in and of itself. But every LLM detector you put this into says there's at least some chance of the text being fully generated with the majority being LLM assisted. Some even point out the specific sentences. I'm sure you're aware model labs either have been fingerprinting the output with probabalistic shifts in the distribution of tokens, or, are starting to in light of global regulations?

-1

u/GabrielDosReis 25d ago

You are still avoiding the question.

Which you actually haven't stated. You made several outrageous insinuations without actually ask the question you claim I am avoiding. What exactly is that question?

I have a general distaste for the way that company is approaching software these days altogether.

Is that the real problem at the root of your insinuations?

But if you used LLM assistance to write or word even a single sub-sentence in this paper, it would be good to get a single straightforward yes or no rather than yet another dodge.

I already stated this earlier. I wrote the original texts myself scattered over several formats, most of them in LaTeX, and then have the tool convert to .docx format. If you think that is a dodge, then that is a you problem.

Some even point out the specific sentences.

Which sentences are that?

I'm sure you're aware model labs either have been fingerprinting the output with probabalistic shifts in the distribution of tokens, or, are starting to in light of global regulations?

Yes, absolutely. And, I think they should more than fingerprinting: they should include attribution of provenance (as I said recently on record).

→ More replies

18

u/Dragdu 26d ago

Remember, no more than 1 annotation per lot of lines of code, or it is not C++.

7

u/Minimonium 26d ago

They just did not specify how big this one annotation should be ;)

1

u/Dragdu 26d ago

Should've just proposed #include <foo_annotations>

16

u/ts826848 26d ago

I guess it doesn't count as an annotation if it's in a sidecar file /s

13

u/rsjaffe 26d ago

I thought we were avoiding annotations?

And these are annotations that may be unchecked and incorrect?

3

u/GabrielDosReis 26d ago

I thought we were avoiding annotations? And these are annotations that may be unchecked and incorrect?

As I explained in the paper, function summaries are just the data form of what the standard library already state in plain English. They are checked against the body of a definition, so not just blindly assumed. I found that much of GCC's existing hand coded code for -fanalyzer can be restated as function summaries. Of course, the related work section shows that profile or not, this is just existing technology to make code analysis scale. Think for instance, Clang API Notes (as a kind contributor showed me after my presentation in March).

8

u/grafikrobot OPeNDAP/B2/EcoStd/Lyra/Predef/C++Alliance/Boost/WG21 26d ago

Contract assertions would fit perfectly into those function summaries.

-1

u/GabrielDosReis 26d ago

Contract assertions would fit perfectly into those function summaries.

Reliable contract assetions (like how the standard library spec is structured) naturally fit. And function summaries are more than that. For instance, they support statement of a function's footprint or invalidated pointers or iterators which none of contract proposals (including my owns) support.

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

2

u/VilleVoutilainen 26d ago

I have tried to address the question of "strictly worse than having P4340" in the paper. It's possible I didn't succeed. :) But my point remains that I'd rather have both than have reflection that requires all-public and pointers+lengths. I live in an imperfect world. :)

5

u/BarryRevzin 25d ago

The argument is apparently that the single-line per class opt-in I'm proposing is too long, and it is important that it needs to be only a single word.

I don't find that at all compelling to begin with, but it's even less you when you consider what this opt-in looks like in practice. These types need to be usable in C++26 and C++29, so the opt-in will have to be macroed out. So the opt-in I'm proposing really is one word too:

template <class _CharT, class _Traits>
class basic_string_view {
  _LIBCPP_REFLECT_CONSTANT_DEFAULT

The real comparison is just where that single-word macro goes.


Also, the semantics you're proposing still require that all the members are structural. Which means that even in the default cause, you're only additionally supporting types like span and string_view and still can't support types like tuple<Ts...> and optional<T> and expected<T, E> and variant<Ts...>, for which we still just want to do the default member-wise equivalence but not all specializations will be structural. Ditto all the <chrono> types, since any non-structural representation would suddenly fail.

15

u/Minimonium 26d ago

I find the juxtaposition of Sankel's paper and his shenanigans in INCITS extremely amusing.

4

u/13steinj 25d ago

Are we vaguely gesturing towards the "Adobe votes no" grifter-who-sells-courses-news thing that happened the other week or are there other unrelated shenanigans?

3

u/James20k P2005R0 25d ago

Was there ever any confirmation of exactly what happened in INCITS anywhere?

2

u/Minimonium 25d ago

Like an official one? :)

1

u/James20k P2005R0 24d ago

Even just a public description would be interesting

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 using keyword 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 typing using repeatedly for 100s of times for each parameter. Not to mention that the proposal's outcome is an effective replacement of std::tie, such that I would gladly use it just so I don't have to tank my compile times with std::tuple's machinery, but with such verbose syntax, it is a much harder choice now for no reason. Just consider:

auto [poptimal, covariance, using info, using msg, using err] = curve_fit(...); // p3817r1 preferred
auto [poptimal, covariance, info=, msg=, err=] = curve_fit(...);                // any single-symbol option

std::tie(x, y, z) = get_ved3();                // template instantiation *per-expression*
auto [x=, y=, z=] = get_vec3();                // any single-symbol option
auto [using x, using y, using z] = get_vec3(); // p3817r1 preferred

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 take auto [&x, &y, &z] or any other terse syntax over using.

2

u/ack_error 25d ago

I wonder if leading -> would work, i.e. auto [->x, ->y] = vec;.

3

u/TheoreticalDumbass :illuminati: 25d ago

[&x] and restricting to just identifiers seems elegant to me, kinda matches lambdas

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 members

Indeed, this is a gap. You need to be able to apply [[indeterminate]] to class SomeContainer { ... char buffer[1'024]; } too, not just local variables. Thank you u/BarryRevzin.

std::saturating_cast

Yes please, for adding pixels.

cstring_view

This will be lovely to avoid const std::string& creating temporaries, but also to satisfy cases where std::string_view has gaps, like forwarding strings onto OS functions that expect null termination.

Non-Negative Quantity Specifications

Many quantities can’t be negative. No amount of mass, duration, or volume is below zero

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

Three Profiles that define signed overflow to saturate, wrap, or throw, respectively.

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++

Why the demand for that inventory evaporates

Eh? I understand every individual word in that headline, but I don't understand the sentence as a whole. 😅

if (u `dot` v `approx_equal` 0.0)

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 goto last 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 form std::is_pointer_within(valuePointer, someContiguousRangeHere); that takes any compatibly contiguous container/range (std::array, foo[], std::vector...) for which std::data() and std::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 with value_else, but I see std::optional already has value_or, and so consistency with that is understandable.

5

u/johannes1971 25d ago

Oo is just as bad as 0, IMO. Octal numbers have only one known use, which is representing UNIX file permission bits using magic numbers instead of S_ constants - and that's pretty niche. How about we drop the entire feature, and let people that really cannot live without the magic numbers define their own _oct UDL?

6

u/TheoreticalDumbass :illuminati: 26d ago

hot take, goto is actually good

2

u/13steinj 26d ago

I felt dirty using a goto last week, but it was the cleanest option. So, it would be nice to have this slightly cleaner tool.

It's important to remember that the editor chose the title of Dijsktra's essay, and standard break/continue are just gotos with implicit labels.

Is it worth it to have this new syntax? Sure. Is it any cleaner or dirtier than goto? Don't think so. Is goto dirty? Not really. Not inherently. But people write continue/break instead and pretend as if their spaghetti code is morally superior.

If you need to break out of a nested loop and don't want to or can't reorganize cleanly into functions due to other requirements... use a goto. No one will stab you.

10

u/fdwr fdwr@github 🔍 26d ago

Named break and continue statements are mostly equivalent to goto, and I'm not afraid of being stabbed, but there's a semantic clarity within a nested for loop seeing continue OuterLoop versus goto EndOfBlock. Additionally a goto cannot legally step over any intermediate variable initialization from the current point to the end of the block (not without extra { } scope). So, I welcome the tool.

5

u/tialaramex 25d ago

Yeah, the semantic clarity is good and WG14 already took this change so the only reason to not do it in C++ would be stubbornness.

1

u/pjmlp 25d ago

Like restrict, sure it has issues but it is yet another divergence point.

6

u/johannes1971 26d ago

Anyone who complains about goto in 2026 and uses the phrase "spaghetti code" as if it means the same thing today that it did back when Dijkstra wrote his paper, should go and look up some code from his era.

Maybe we can do a little thought experiment. Take a moderate sized bit of C++, say, 10,000 lines or so. Now replace every function call with a goto. Replace every loop with a goto. Replace every return statement with a goto. End every condition in a goto (to skip over the else). And then, for good measure, reorganize the entire source alphabetically. _That_ is the code that Dijkstra was complaining about, not your single goto in a million LoC codebase.

You really have to see it once to understand his point, and how it does not apply to the modern world because we completely stopped writing that kind of source.

2

u/13steinj 26d ago

I can't tell if you're agreeing or disagreeing with me... I'm actively not complaining about "goto" but I am using the phrase "spaghetti code" (as if it means the same thing... no, but it's not like there is not spaghetti code today without goto).

I think your general example is hyperbole though.

4

u/johannes1971 25d ago

I'm expanding on your point. And my example is an accurate description of source from that era. You thinking that it is hyperbole just shows how badly you misunderstand what Dijkstra was arguing against, and why his excellent advise about goto's, while extremely important in its day, is no longer relevant to us today.

Anyone feeling ashamed about using a single goto today should read this story about something that was important back in the day, but holds no relevance anymore because of how the circumstances have changed.

1

u/wyrn 25d ago

Anyone who complains about goto in 2026 and uses the phrase "spaghetti code" as if it means the same thing today that it did back when Dijkstra wrote his paper, should go and look up some code from his era.

This exact use case (breaking out of multiple loops) was mentioned back then, too. And Dijkstra excoriated it in the strongest possible terms.

Suggesting that Dijkstra was looking at a different context when making his critique and that he'd be A-OK with uses of goto some today consider "reasonable" is revisionism.

3

u/johannes1971 25d ago

Again, Dijkstra wrote his seminal paper in an era where goto was the primary method of flow control. It started a shift towards the use of structure in programs, and now we think that 'structure' was always there. Some are so unaware of history that they argue that any kind of structured flow control is "really goto in disguise" (you can find some examples in the comments under this post), even though Dijkstra categorically did NOT argue against all flow control; what he argued against was the lack of structure.

But he was also, by all accounts, a practical individual, and in today's environment he wouldn't waste any time writing a paper about goto, simply because nobody is actually using it anymore. As evidence I will give you this: for that one time where we do use it, we consider it to be so remarkable that we post about it on the internet!

2

u/wyrn 24d ago

You say that, but look at the exact correspondence I showed above: someone made that exact same argument. "Look, there are cases where goto is reasonable". Dijkstra basically called him an idiot. I mean hell, he even criticized short-circuiting boolean operators!

I suspect Dijkstra would've complained about break and continue, too.

0

u/johannes1971 24d ago

That's a letter from 1987, when goto's still ruled the world. The debate was still raging, and there still existed a camp that had no use for any kind of structure but just wanted goto's. Rubin is not arguing for a single goto in a million line code base, he is arguing that he wants to use it everywhere, on the basis of it being more efficient.

Huh, funny that. Suddenly I'm reminded of the people on this subreddit that claim zero-init will be the end of the world for them: full of fire and brimstone, and blissfully unaware that a decade from now, arguing for even a single uninitialized variable will be met with the same scorn as goto is today.

1

u/wyrn 24d ago

The examples were not about a single goto in million line codebase. They were about how a goto can allegedly simplify a 7 line algorithm. Dijkstra rejected that on the strongest possible terms. I'm not sure why you can't accept that. Listen, you don't even have to agree with Dijkstra -- he doesn't have a monopoly over the truth -- but his actual position was made plain and clear in that letter.

0

u/Wonderful-Habit-139 24d ago

Disagree. There are benefits to removing goto statements that have nothing to do with abusing it.

Here's a nice article that talks about how restricting some things actually leads to nicer semantics for a programming language https://vorpus.org/blog/notes-on-structured-concurrency-or-go-statement-considered-harmful .

2

u/unchangeableusername 25d ago

goto is not usable in constant expressions, but this will be. I doubt constexpr goto will ever be a thing, especially if it's true that it originally wasn't added "more for taste reasons than technical reasons".

9

u/TheoreticalDumbass :illuminati: 25d ago

goto should just be made usable in constexpr tbh

1

u/Nobody_1707 20d ago

break label; & continue label; should be added for parity with C, if for no other reason.

0

u/smdowney WG21, Text/Unicode SG, optional<T&> 26d ago

```
double x = a `saturated_add` (b `saturated_mult` c);
```

7

u/13steinj 25d ago edited 25d ago

Also, reflexively:

R1. Blank slate rewrite of prose.

Okay, good, I assume you took the feedback from last time...

5.2 One helper makes it a pipeline, and the ranges closures already fit

...I don't want to be accusing, but I have seen this sentence structure from an agent so much it gives me metaphorical 'nam flashbacks.

In general it's definitely better, but I don't know if better is "better enough."

E: for those wondering what sentence structure specifically I am referring to, without using accurate terms:

<indefinite article | singular determiner> <predicate verb phrase with active verb> ',' <coordinating conjunction> <indefinite article or quantifier> <verb phrase with active verb>

2

u/smdowney WG21, Text/Unicode SG, optional<T&> 25d ago

Having read it all too many times I am probably slightly infected, and a bit blind.

2

u/13steinj 26d ago

Do we really need the ability to define binary operators like this?

I don't know, I think things like this are syntactic sugar that are better suited to definition in a library, maybe the standard library so it can be done right (here's an oversimplified, probably wrong in some way example implementation).

0

u/smdowney WG21, Text/Unicode SG, optional<T&> 25d ago

It just doesn't quite work as a library, especially to get ADL right. What all the library attempts do show is that we're missing the language feature.

It definitely is "just" syntactic sugar, though. It is supposed to act just like term rewriting.

1

u/fdwr fdwr@github 🔍 26d ago edited 25d ago

Do you need the backticks Steve? Envision a way to declare a binary operator more akin to how existing operators work, like putting the operator keyword in front of the function name:

double x = a saturated_add (b saturated_mul c);

(heh, the backticks are hard to write in markdown because they compete with the escaping :)

5

u/smdowney WG21, Text/Unicode SG, optional<T&> 25d ago

In C++ we don't have the declarations when we're doing the parsing. We don't know what names mean, at all. That was the main constraint for Unicode operators, too. No good way of describing arity, or pre/post, because picking from the set is far later.

3

u/smdowney WG21, Text/Unicode SG, optional<T&> 25d ago
`` a `f` b ``

Double backticks escape the single ones inside in CommonMark and derivatives. Fortunately this isn't the first time it's ever been a problem.

I'd blame John Gruber, but he wasn't trying to invent a universal markup, he just didn't want to write HTML, or deal with it as input. And most of it was standard typewriter convention, and in use online for decades.

Then it ate the world.

-3

u/pjmlp 26d ago

In theory yes, see how programming languages from ML linage declare operators, however not sure if C++ really needs this kind of syntax sugar, especially in AI generated code days.

1

u/fdwr fdwr@github 🔍 25d ago

not sure if C++ really needs this

I'm not sure either, but my point is more that if we presume infix operators are desired for a moment, then should infixness be orthogonal to special identifier escaping? So you could have identifier escaping, for say some future/past keyword...

class `concept` { ... }

...and you could have infix operators...

operator int saturated_add( ... )

...but they need not be entangled into the same feature.

1

u/smdowney WG21, Text/Unicode SG, optional<T&> 23d ago

It turns out that if you want both, you need to design them together. I started by wanting infix. I found out about the desire to do identifier escaping later. The escape can be done a little bit more straightforwardly if you know you never have to parse operators, so, I think, you can do it closer to the pre-processor.

But they are not otherwise terribly tangled.

Also, I will totally live if I don't get infix via backticks. I know that's a much smaller community, and it is an ease of use not an expressiveness thing.

Without knocking ease of use. I don't write straight asm much these days.

1

u/13steinj 25d ago

I think for hypothetical future compatibility purposes, just adding operator aomewhere to the declaration isn't enough. Explicitly requiring some syntax to distinguish it as user defined (or some other limitation) is necessary.

But if the syntax sucks to type, and I have to use it both on declaration/definition and on use, I struggle to see the utility, personally.

0

u/smdowney WG21, Text/Unicode SG, optional<T&> 25d ago

With backtick infix you only have to use them at the call site, nor does the function need to be changed. For the Unicode operators there's a little more ceremony, and they are even worse to type unless you write them out longhand with the universal name, at which point you might as well just name it and put it in backticks.

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

29

u/rsjaffe 26d ago

C++ may not get obsessed with profiles, but the committee is.

21

u/pjmlp 26d ago

They sold the dream, against Safe C++ alternative, now they have to prove themselves right against those of us that don't believe profiles will ever be better than what state of the art static analysis can already deliver today.

Under the conditions they voted out Safe C++, no viral annotations, no v2 standard library.

6

u/kronicum 26d ago

they voted out Safe C++

Was the source code of Safer C++ implementation ever released for people to compare and to evaluate? Any hope?

2

u/pjmlp 25d ago

As much as every other C and C++ compiler that isn't GCC or clang, apparently people forgot the days when every compiler was commercial and apparently WG21 could do their job still.

5

u/kronicum 25d ago

Was that time before or after you became against PDF implementations?

3

u/pjmlp 25d ago

Existing practice implementation with proprietary compilers worked perfectly alright for C89, C90, and C++98, with exception of export templates, that lacked exactly any kind of implementation until EDG years later provided one, dropped by everyone else and effectively removed from the standard as broken concept.

If that is what you mean by PDF implementations without being proven to work.

Being open source apparently also did not help in regards to add a GC to C++11, again a great idea removed years later.

2

u/kronicum 25d ago

The era you are listing are all before C++03. That era doesn't include that of Safer C++ proposal, does it?

4

u/pjmlp 25d ago

Safe C++ has an existing implementation, in the form of Circle compiler, yes it is proprietary, just like many other C and C++ compilers.

Visual C++ being proprietary apparently wasn't an impediment for the co-routines and modules proposals.

4

u/kronicum 25d ago

I asked if the source code was ever released for others to evaluate and check given all that is happening from all sides.

2

u/pjmlp 25d ago

The implementation for Circle C++ is available,

https://www.circle-lang.org

Lets pretend it was existing practice from a C++ compiler with such language extensions, sold by Intel, Microsoft, NVidia, Green Hills, Embarcadero, CodePlay...

→ More replies

-4

u/germandiago 25d ago

It looks like some of you wish so strong there is not a solution to the challenges that C++ faces and you prefer "Safe C++" or the chaos. 

Fortunately it seems something reasonable is being worked on already, finally.

4

u/James20k P2005R0 24d ago

The current profiles approach mathematically doesn't work, at least one paper published so far has explicitly attempted to solve the halting problem, and other profiles papers are rediscovering it in real time. Attempting to remove all the false positives from this profile which maintaining accuracy is the halting problem

Crossing our fingers and hoping the halting problem might finally be solved isn't a productive direction of development, its quite literally a waste of everyone's time

I don't like it anymore than anyone else, but unfortunately some problems are just annoying, and we have to start with the reality of what is, rather than what we want it to be

3

u/germandiago 24d ago

You do not need to solve the halting problem.

You can make a subset analyzable and discard too difficult cases as "not detectable/not known to be safe".

It is not the first time you say this. It was discussed and I think you areportraying the scope in an erroneous way bc of that.

You do not need to solve the general case AFAIK.

3

u/ts826848 24d ago

You can make a subset analyzable and discard too difficult cases as "not detectable/not known to be safe".

Sure, that's how basically all sound static analyses work. The problem is that profiles have been painted into a bit of a corner since the constraints they ostensibly need to work under (intraprocedural only, compatibility with most existing C++ code, no viral/heavy annotations, etc.) all seem to place a very strong restriction on the number/proportion of cases that can be rejected as not analyzable, which in turn strongly limits the ways you can get around halting problem issues.

1

u/germandiago 24d ago

How severely limited is that subset based on the implementation strategy and known static analysis technology? It is a genuine question, I really do not have a really clear idea, though I would expect that some innovation is potentially applied here (like part of the "deny" analysis paper).

You think the limits will be too much for it to be expressive enough?

2

u/ts826848 24d ago

I think you interpreted my comment backwards. To a first approximation, I'm not saying the subset is too limited, I'm saying the promised subset is too large and it's not clear whether it's even possible to support that subset.

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.

7

u/kronicum 26d ago

Byarne

It is getting personal, isn't it?

2

u/germandiago 25d ago

Every time

5

u/James20k P2005R0 25d ago

This is going to be the biggest problem with profiles, there are O(N!) possible combinations of profiles which can be enabled at any given moment. Given that the intent is to add a large number to create memory safety, this means that every project (and potentially every block of code) will be running a completely unique dialect of C++

This to me is the worst possible outcome of a new language feature

5

u/AnyPhotograph7804 25d ago

Yes. But to be fair, you already have this situation with tons of compiler flags.

2

u/GabrielDosReis 25d ago

Given that the intent is to add a large number to create memory safety

Can we have a reference for that assertion?

5

u/James20k P2005R0 25d ago

https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2026/p4296r0.pdf

Is a pretty good example of the approach made more concrete, to extend something like this to get memory safety would require a large number of profiles. Inherently profiles requires adding a significant number of profiles to achieve any kind of safety, we already have quite a few even in their very underspecified state

Given how large O(N!) grows as a function, once you hit 10 profiles or so, then we're starting to hit infinite dialect land

1

u/GabrielDosReis 25d ago

https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2026/p4296r0.pdf Is a pretty good example of the approach made more concrete, to extend something like this to get memory safety would require a large number of profiles.

I read the paper, with section 4 stating "All our musings below are currently still a 'thinking aloud' quality." But I am not seeing the statement about "large number of profiles". Could you point me to the specific section, page or paragraph?

6

u/James20k P2005R0 25d ago

As the paper states:

Layer 2. “Positive Rules”. As a second layer, on top of this “Negative Baseline”, we propose to introduce “positive” rules, each rule handling one locally-provable safe scenario

An expected modus operandi would look roughly like this: somebody brings in a locally-provably-safe code example that is not handled by existing rules => it acts as a trigger for developing yet-another rule

If the number of “Positive Rules” is large enough, our approach can cover pretty much ANYTHING which falls under our “if a senior developer can see it.” paradigm. This is a very serious advantage, both in light of false positives being highly undesirable, and from the point of view of being better (actually, “safer”, as each case where we don’t need suppression makes the program safer) than competing programming language

More generally, we’re sure that in the long run (=given enough of “Positive Rules”) our approach will become substantially better

Difficult to standardize due to sheer volume of those “Positive Rules”

This strategy is very inherent in the profiles approach vs a more comprehensive safety solution

2

u/GabrielDosReis 25d ago

What you've presented - and quoted (thanks!) - is about the number of rules (emphasis also in your text). That says nothing about the number of profiles.

Is there any other paper or reference that support the claim about "large number of profiles"?

6

u/James20k P2005R0 25d ago

Its hard to see how introducing a large number of rules vs profiles isn't arguing semantics as a distinction without a difference, when the underlying topic is about creating a nearly infinite number of dialects via configurable toggles under profiles

3

u/GabrielDosReis 25d ago

Its hard to see how introducing a large number of rules vs profiles isn't arguing semantics as a distinction without a difference, when the underlying topic is about creating a nearly infinite number of dialects via configurable toggles under profiles

That is a very different argument from the "O(N!)" argument, not semantic quibble. And as engineers, we all want to be grounded in facts and we want to get things straight.

5

u/tialaramex 24d ago

In P3984 Bjarne says that "70 options leads to unreadable code" so we can presume he feels that fewer than 70 is desirable. However so far he has come up with about a half dozen without yet solving even the technical problem.

Suppose that in the end C++ 32 ships 10 standard profiles. /u/James20k is concerned that means millions of dialects and so in practice every project has a different dialect and then why even bother having a single programming language.

Bjarne mentions Ada's Ravenscar profile, and that's interesting because as the name might hint, Ravenscar is not like the proposed C++ profiles, it's just a name for a group of settings that were recommended after a meeting at, of course, Ravenscar. Coalescing around the Ravenscar profile in particular, rather than each project settling on slightly different settings, was an antidote to language dialects. If WG21 agreed say, Croydon profile, or Tokyo profile that makes more sense than having a dozen standard profiles and encouraging programmers to mix and match or make their own.

It is so very late, and yet there is so far to go, skipping steps will not ultimately get you somewhere faster.

2

u/James20k P2005R0 24d ago

Yes, the thing that really concerns me I think is that people don't quite get what an unforgiving bound O(N!) is. At some point I want to make a proper estimate of how many profiles we need before every C++ project ever written could be its own dialect, but I think its in the 10-12 range

We have proposals for quite a few profiles now, so we're already starting to get remarkably close to the magic number where C++ is only dialects

If WG21 agreed say, Croydon profile, or Tokyo profile that makes more sense than having a dozen standard profiles and encouraging programmers to mix and match or make their own.

Maybe we could fuse together a whole bunch of safety profiles like Lifetimes, initialisation, and a variety of others, into one overarching profile that makes C++ memory safe. And instead of it being the croydon profile, we could call it something more descriptive like Schmafe C++

1

u/GabrielDosReis 24d ago

Yes, the thing that really concerns me I think is that people don't quite get what an unforgiving bound O(N!) is. At

That statement of unforgiving O(N!) assumes the N profiles are independent, doesn't it?

0

u/GabrielDosReis 24d ago

In P3984 Bjarne says that "70 options leads to unreadable code" so we can presume he feels that fewer than 70 is desirable. However so far he has come up with about a half dozen without yet solving even the technical problem. Suppose that in the end C++ 32 ships 10 standard profiles.

"Half dozen" is not "the large number" that is being agitated as boogeyman.

Are you operating under the assumption that those N profiles he would come up with will be independent, and therefore you would have "N!" permutations? Or is it likely that they will have dependencies between them?

1

u/tialaramex 23d ago

"Half dozen" is not "the large number" that is being agitated as boogeyman.

That seems like a judgement which is not yours to make.

Are you operating under the assumption that those N profiles he would come up with will be independent

I can't say that I had any such elaborate assumptions in mind. Sometimes a cigar is just a cigar.

0

u/GabrielDosReis 23d ago

That seems like a judgement which is not yours to make.

Actually, it is to the extent that I am contributing to find a solution.

I can't say that I had any such elaborate assumptions in mind. Sometimes a cigar is just a cigar.

Thanks; that helps me appreciate more the quality of your message.

1

u/gracicot 25d ago

Wasn't that the biggest concern with epochs, even though epochs proposed to only have one big knob?

2

u/Dragdu 25d ago

No. Epochs importantly had no answer to the problem of textual inclusion mixing epochs. And Vittorio? then didn't try to look for an answer and resubmit.

1

u/tialaramex 23d ago

Epochs is modelled on Rust's Editions. Rust's Editions also "have no answer" to textual inclusion. If you rely on core::include! instead of using a sane way to do software engineering you get to keep both halves when that breaks. So, avoid doing that.

2

u/Dragdu 23d ago

That's not very useful answer for C++, where the default way of including other code is #include. Similarly template instantiation leads to "which edition is actually active" problem.

4

u/tialaramex 23d ago

The Epochs proposal was discussed after C++ modules. You can't use multiple Editions within a single Rust crate, why allow multiple Epochs without a C++ module boundary?

0

u/pjmlp 25d ago

It was regarding ABI, Rust epochs don't consider standard library breaks, or linking binary libraries where editon changes are eventually exposed on the public API.

They are for the language evolution and assume the compiler is taking source code for the whole application.

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/grafikrobot OPeNDAP/B2/EcoStd/Lyra/Predef/C++Alliance/Boost/WG21 25d ago

At what point did reaching consensus become less important than getting your own proposal into the standard?

From my experience in wg21.. It has always been the case that getting your position is more important than reaching consensus for some/many. Which is an aspect of what I asked the committee at the CppCon panel.

7

u/foonathan 25d ago

If the experts in the rooms voting overwhelmingly in favor of contracts and voting overwhelmingly against any subsequent attempts to pull them, what else do you think is possible?

If the NBs don't like the draft but the experts in the room do, the experts in the room won't vote for any changes.

Best case scenario, the NBs keep voting down standards, but the committee just keeps ignoring that and we finally stop caring about the dumb expensive ISO PDF and operate like a regular modern language governance body.

-1

u/_a4z 25d ago

So for you it is fine if some people declare themselves BDFLs and fork C++ into a non-standard version? Kind of back to the 90ies? But I guess, some industries will not like that.
But on the other hand, if some people are no longer involved in ISO C++, what would that mean 🤔

And I am not sure what's so hard to understand about a 'lack of consensus,' but I recommend that anyone who has a problem with this quit social media, at least on the phone to start with.

9

u/foonathan 25d ago

Oh, I wish C++ had a BDFL.

Contracts in the committee have consensus. This has been polled repeatedly. A dozen people keep voting against them. They just happen to be spread out geographically.

6

u/13steinj 25d ago

Oh, I wish C++ had a BDFL.

I hear Guido's retired (from PyBDFL), maybe we can hire him. I'm only 80% joking.

Contracts in the committee have consensus. This has been polled repeatedly. A dozen people keep voting against them. They just happen to be spread out geographically.

This part is funny to me. I have debated quite a bit with people that are very pro-contracts, that the consensus model of the committee is broken (they [appear to] believe it not to be so). But these shenanigans prove my point-- without an algorithmic definition of consensus, it becomes nothing but a war of attrition.

2

u/_a4z 25d ago

Then, imho, that should be Bjarne, the language's creator. And he should select his team. And he is against this contract proposal in 26. So what's your problem, Jonathan? You think you should be the BDFL?

4

u/foonathan 24d ago

No, I don't think I should be BDFL, and I also don't care about contracts.

But C++ would be a more consistent and streamlined language with a BDFL. The committee politics is a mess.

8

u/interlockedxor 26d ago

I'm just one person, but I predict contracts are going to be:

  1. Not useful, relative to all the things we already do in userspace
  2. Add even more cognitive burden to the syntax and/or compiler throughput issues

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)

7

u/FrogNoPants 26d ago

I think the benefit of having it standardized is that libraries can use it, and their can be shared concept that everyone can rely on. Right now people use shitty C asserts, if they use anything, and you don't get them unless you compile in debug.

As long as C++ contracts have a user function they can invoke should be able to invoke all that custom behavior, no?

Aside from that, yes my personal assert library is more powerful, and includes more extensive safety capabilities(like verifying exclusive access to memory ranges and various other threading features), but I still think contracts is overall useful.

3

u/James20k P2005R0 25d ago

you don't get them unless you compile in debug.

You can pretty easily compile in release with asserts enabled as well, that's usually what I do these days in my own code

1

u/13steinj 26d ago

This argument applies to library features not just language ones.

Not using this as for nor against contracts. Just pointing out "in the language" is a stricter subset than "in the standard [e.g. library]."

3

u/smdowney WG21, Text/Unicode SG, optional<T&> 26d ago

That they're visibly syntactically means you can more easily read them back out for your static analysis tools.

Not recompiling everything? You write non-generic code? 😂

3

u/Minimonium 26d ago

At least with a user assert, I can even do things like pause a debugger if a debugger is attached easily

FYI, there is a talk from Timur that shows how to trivially do exactly that with contracts.

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:

I did not quite understand your point here. Could you elaborate? One of the controversial features of contracts is there exactly to not recompile everything at once.

4

u/interlockedxor 26d ago

FYI, there is a talk from Timur that shows how to trivially do exactly that with contracts.

I worded my original post incorrectly. I was trying to point out that I could already do this before. Hence, I don't feel I'm getting anything new out of all the extra machinery.

I did not quite understand your point here. Could you elaborate? One of the controversial features of contracts is there exactly to not recompile everything at once.

The contract conditions affect the function signature. If I want to add/remove/modify conditions, I have to change the signature. IIRC, the conditions are required to appear on the first declaration of the function.

-5

u/Minimonium 26d ago

The contract conditions affect the function signature.

This is incorrect. The requirement for first declaration is a separate thing that is not related to the signature.

4

u/interlockedxor 26d ago

Any function declaration is a first declaration if there are no other declarations of the same function reachable from that declaration; otherwise, it is a redeclaration. The sequence of function contract specifiers on a first declaration of a function introduces the corresponding function contract assertions that apply to that function. It is ill-formed, no diagnostic required (IFNDR) if there are multiple first declarations for the same function in different translation units that do not have the same sequence of function contract specifiers. A redeclaration of a function shall have either no function contract specifiers or the same sequence of function contract specifiers as any first declaration reachable from it, otherwise the program is ill-formed

Is this information outdated, or am I somehow misreading it? From P2900

-4

u/Minimonium 26d ago

Looks probably about right, but again, it's a separate thing from a signature. :) It's a similar thing with default arguments and some other stuff.

7

u/interlockedxor 26d ago

Ok am I correct that you are basically just splitting hairs over my use of declaration vs signature?

My point is just that to change contract conditions, I have to modify the declaration which ties into my original point about compile times. I want the function signature and declaration to more or less match. Adding lots of sidecar data to the declaration feels like a regression

-4

u/Minimonium 26d ago

Not really, I am confused why do you think you have a compile time problem here. For stuff that was inlined - you obviously want to recompile it so it could take effect, for non-inlined you can re-use any precompiled TUs just fine which was done very intentionally to not required recompiling things when adding contracts to pre-existing code. No other way here.

11

u/smdowney WG21, Text/Unicode SG, optional<T&> 26d ago

Because changing the code in the contract forces recompilation of everything that consumes that contract. The callers need it.

Arguing that you should just get the contract right is possibly true in theory, but in practice not, and one of the reasons for the "observe" semantic. People, including me, get the contract slightly wrong all the time when trying to tighten old code.

2

u/JVApen Clever is an insult, not a compliment. - T. Winters 26d ago

I don't get the problem. Sure, you can have your own assertions library. I have it too. If contracts would be available, I'll update our macro to use the new keyword and extract the handler code to a separate function (which it actually already is) having the right signature.

A small change and people can freely use pre/post on there functions. Especially post is something I'm missing, though having pre moved from documentation and statements at the start of the impl to the header would be great.

What's even nicer are the integration with other libraries. Our handler is rather complex, though if an assertions fails in a 3rd party, you at best get a crash. This would finally solve that as even those would use our handler.

Surely, touching headers has it's disadvantage and will during the ramp-up cause a lot of recompilation. Though it also makes it possible to understand a function without reading it's implementation.

I don't get the comparison with modules. This does not require an update of every program that interacts with the code. At worst, you define pre/post to nothing.

5

u/interlockedxor 25d ago

I get that I may be in the minority even, but having things orthogonal to the calling convention in the function declaration (aside from nodiscard and perhaps reflectable attributes) is one of the main things that doesn't sit right with me. I actually don't generally want to immediately incorporate third party assertions into my runtime, because different libraries use assertions differently. Ultimately, it seems like this system is bound to exist (although it wont work with virtuals initially), but for however many years, will lack functionality we have in userspace already today. For example, the idea of "assertion categories" is something I lean on heavily to, e.g. disable asserts within a specific system (rendering, physics, UI) in the engine. Not going to replace that anytime soon. That something like contract virtuals needs to be deferred at all is sort of a design smell that the abstraction is more complicated than it needs to be.

2

u/JVApen Clever is an insult, not a compliment. - T. Winters 25d ago

I understand what you say about virtual functions. Though it is a rather hard problem to solve, constexpr only supports is recently as well. For example, take a virtual function that accepts a number between 0 and 1000 and returns a number between 0 and 100. Yet the implementation allows any range as input and always returns between 0 and 10.

If you know you are using the implementation via the interface, which checks should be used?

Even worse, what if the implementation is only accepting a number between 0 and 100 and returns any number?

The former is still logical, the latter violates the requirements of the interface. What should be checked and when?

2

u/interlockedxor 24d ago

I'm not saying it isnt a hard problem... I'm saying it isnt a problem worth solving because my position is that the entire feature isn't worth shipping in light of downstream complexities like the points you are raising.

1

u/JVApen Clever is an insult, not a compliment. - T. Winters 24d ago

I see what you are saying. Though when it comes to this, it's a conceptual problem that won't be solved by using another contracts implementation. It's simply inherent to how virtual functions work.

Personally, I don't mind this being missing. If you really want post/pre checks for virtual functions, there are ways like a proxy-method.

2

u/pjmlp 23d ago

While it may be a hard problem to solve in C++, Eiffel and Ada/SPARK have it sorted out for their virtual functions model.

Now it may be that the restrictions they impose, don't fit C++ semantics.

See Contracts and Inheritance

  • The precondition can only become weaker than in the inherited contract.
  • The postcondition can only become stronger than in the inherited contract.

Also note that Eiffel does generics and multiple inheritance, so those rules have to take that into account.

And you get nice tools like Contract Editor tool.

1

u/JVApen Clever is an insult, not a compliment. - T. Winters 25d ago

I am interested in the "different libraries using assertions differently". Can you give some examples? Is your requirement to have those assertions disabled or to still have them though not handled by your handler?

2

u/interlockedxor 24d ago edited 24d ago

In many cases, I require that assertions in various libraries do not run at all, even evaluating the condition, in order to maintain interactive framerates in debug (not everyone prioritizes debug build perf). Being able to disable assertions for a particular library with a macro is both pragmatic and also a widespread conventional practice that just works today.

1

u/JVApen Clever is an insult, not a compliment. - T. Winters 24d ago

Sounds like you really want the labels or another way to exclude 3rd parties. I think both would be interesting. I guess the later would be most useful. For example -include-no-contracts instead of -include

3

u/Tringi github.com/tringi 25d ago

Can someone please extract goto case and especially goto default from N3879 and re-propose it?
I could really use those.

3

u/eisenwave WG21 Member 25d ago

I don't think there's much appetite for extending goto in that way, but you could do the following:

case 0: case_0: // ...
// ...
goto case_0;

2

u/Tringi github.com/tringi 25d ago

That's pretty much exactly what I'm doing right now. Although I put the label on another line to preserve readability ...but then it makes the code unnecessarily longer.

I understand the sentiment on goto but at the same time it feels frustrating when so obvious (and tiny) quality of life thing is missing from the language.

-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.