r/cpp 7d ago

cpp2 (cppfront) is over?

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

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

65 Upvotes

112 comments sorted by

View all comments

Show parent comments

1

u/pjmlp 4d ago

It solves the problem by not being copy paste compatible with C.

Just look at code samples from companies with seat at the WG21 table, even recent ones.

Some devs don't really want to improve themselves, this is even worse among those that aren't on Reddit, HN or could not care for one second what happens at C++ conferences.

Not being copy paste compatible with C solves a lot of problems.

2

u/wyrn 4d ago

It solves the problem by not being copy paste compatible with C.

I mean that was literally the other poster's point though?

In practice Rust solves C's problems, C++ has them only as a result of backwarda compatibility.

2

u/pjmlp 3d ago

Point being C++ has them, regardless how.

Which even the companies that know better, e.g. employer from WG 21 contributors, keep using on their C++ codebases.

The reality among companies where HN, Reddit, C++ used groups, C++ conferences are foreign words, is much worse, where code still looks pretty much like C with Classes for the most part.

1

u/wyrn 3d ago

Point being C++ has them, regardless how.

And Rust has unsafe. Hell, even C#, python, and Java have their own versions of unsafe. "Regardless how".

, where code still looks pretty much like C with Classes for the most part.

Yeah we talked about this before, except turns out there's plenty of actual modern C++ production code out there. I think last time you responded by moving the goalposts, want to do that song and dance again?

1

u/pjmlp 3d ago edited 3d ago

My dance book has a few empty entries.

Those two things aren't the same and you know it, now calling it moving goalposts, it is your words not mine.

Unsafe keyword in a completely different language, and copy paste compatibility with C idioms is quite different.

Maybe I can share new samples from Microsoft, NVIDIA, Google, Blomberg, and co, with C style coding on them.

Shall we go for the first dance?

1

u/wyrn 3d ago

Those two things aren't the same and you know it,

No I don't "know it". You are treating the existence of unsafe features in a language as evidence that the entire language is unsafe. Well, then that applies to all the aforementioned, too. Be consistent.

Shall we go for the first dance?

You mean like you did here?

https://www.reddit.com/r/cpp/comments/1oyc0p0/wait_c_is_kinda_based/npgp73j/

0

u/pjmlp 1d ago

Exactly like that, psychology is fun.

2

u/wyrn 1d ago

Or maybe like you did here?

https://www.reddit.com/r/cpp/comments/1e8mjsr/c_club_172_safety_rust_swift_wg21_papers/letzfxb/

I'm still waiting for you to return those goalposts btw.

0

u/pjmlp 1d ago

Do you want a chair, with cookies and tea to go along? It might take a while.

2

u/wyrn 1d ago

Didn't expect you to freely admit it but alright

→ More replies (0)

1

u/13steinj 4d ago

Firstly, I'm fairly sure it's actually not copy-paste compatible. There's some edge cases there. I used to know them, but they were so rare and I never wrote them, so I removed them from my brain.

I never wrote them because I've never had to copy paste C into C++ nor write it from scratch in this way.

If people consider this C++'s problem, I cannot be convinced. To me the only response I can give is "skill issue. Stop copypasting, stop hiring bad devs out of university." Arguably that's its own problem, that as a society we teach computer science but not "how to be an engineer [and write quality software]."

1

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

We tried saying "skill issue, just don't write bugs" for more than two decades. It didn't work.

1

u/13steinj 2d ago

Not not writing bugs. Writing C-style code in C++.

You can enforce this with decent CI practices and generally static analysis. To the people who refuse to set it up, I've stopped caring.

1

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

"Just don't write bad/non-idiomatic/un-modern code" is equivalent to "Just don't write bugs".

1

u/13steinj 1d ago

That's a false dichotomy. Yeah, you might write non-idiomatic/un-modern code. You catch it in CI using (sometimes custom) clang-tidy checks.

If your organization can't get developer buy in for this, that is on them, IMO.

1

u/pjmlp 4d ago

It certainly is to certain extent, when most enterprise C++ source files are plagued with:

  • C arrays without bounds checking
  • C strings without bounds checking
  • C header files inherited from C standard
  • C style casts
  • C style pointer arithmetic
  • C standard library memory allocation functions
  • C standard library IO for file handling
  • C preprocessor magic tricks

Some of it can be tamed with clang-tidy, Sonar, PVS and co, however management usually has to agree otherwise it gets quickly turned off when pitchforks arrive into DevOps room.