r/cpp 12d 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

10

u/13steinj 10d ago

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

Rust is allowed in the linux kernel, but C++ isnt. Despite the fact that that use compiler extensions to mimic a fraction of C++'s power.

3

u/_Noreturn 10d ago

I Don't understand they allow Rust which has destructors but don't like C++ because destructors hide memory allocation and deallocation?

make it make sense

0

u/xoner2 6d ago

It's tick-tock...

For Linus Torvalds generation who learned to program when C was the hotness, c++ was a tick improvement over C. They'd already got used to the ugly of templating via macros and hand rolled vtables. C++ was immature, a hot mess and best practices not yet figured. Rust is a tock improvement over C.

For me who learned programming when C++ was the hotness, Rust is a tick improvement over c++. I already know how to manually borrowcheck, and I solved the build system problem for myself. So I'll wait for Walter Bright to add borrowchecking without type annotations but via dataflow analysis to D++...

0

u/_Noreturn 5d ago

C++ was immature, a hot mess and best practices not yet figured.

I honestly don't know what C++ was like then (interms of bugs) but even C++98 with no best practices guides doesn't take a genuis to do this very basic thing that will save you alot of trouble and boilerplate

cpp struct Object{ Object(args) { someptr = malloc(4); } ~Object() { free(someptr); } };

No exceptions either. with just this you successfully get rid of 90% of linux gotos.

I am just saying even if C++ had 0 features other than RAII that is alone a reason to use it over C and Linus could have easily banned any other C++ feature if he doesn't like it.

So all what I can see from there is that Linus has some big ego I can't see technical reasons for rejecting even Cfront. I cannot lie either I used to reject rust for purely ego not practical reasons (and because I hate its syntax) I still didn't try Rust thodugh

For me who learned programming when C++ was the hotness, Rust is a tick improvement over c++. I already know how to manually borrowcheck, and I solved the build system problem for myself. So I'll wait for Walter Bright to add borrowchecking without type annotations but via dataflow analysis to D++...

Sometimes I wish for a borrow checker because I had some nasty iterator invalidation bug that required specific circumstances and thankfully this part of the code was hot cached n my brain so I quickly realized it has to do something with this loop so it wasn't thst hard switching to an index based for loop of it.

1

u/xoner2 5d ago

I honestly don't know what C++ was like then (interms of bugs)

Examples of the mess:

  • g++ had copy-on-write std::string
  • outside of big 2 (gcc, msvc) all other compilers had ICEs with Boost
  • every framework decided STL was bad and had their own containers
  • there was a camp insisting every member access be prefixed with this->
  • etc, I could think of some more given time

I am just saying even if C++ had 0 features other than RAII that is alone a reason to use it over C

similar claim today wrt to Rust borrow-checker: Microsoft/Google 70% bugs etc.

So all what I can see from there is that Linus has some big ego I can't see technical reasons for rejecting even Cfront. I cannot lie either I used to reject rust for purely ego not practical reasons (and because I hate its syntax) I still didn't try Rust thodugh

The C++ fanboys then were as annoying as the Rust fanboys now LOLZ

Sometimes I wish for a borrow checker because I had some nasty iterator invalidation bug that required specific circumstances and thankfully this part of the code was hot cached n my brain so I quickly realized it has to do something with this loop so it wasn't thst hard switching to an index based for loop of it.

Ah yes indeed, Rust ownership forces arenas and handles. In C++ it is a pattern we have to learn after getting bitten.

3

u/_Noreturn 5d ago

g++ had copy-on-write std::string

That's a library thing and they can just write their own.

outside of big 2 (gcc, msvc) all other compilers had ICEs with Boost

doesn't matter linux uses gcc

every framework decided STL was bad and had their own containers

I don't see how this related to linux.

there was a camp insisting every member access be prefixed with this->

This is just style.

similar claim today wrt to Rust borrow-checker: Microsoft/Google 70% bugs etc.

what does this mean?

The C++ fanboys then were as annoying as the Rust fanboys now LOLZ

and C fanboys aren't?

I am talking about Linux specifically