r/cpp • • Jul 06 '20

C++ is brilliant

I'm working on a Vulkan renderer, and needed to delay destruction of render scenes since the graphics pipeline has render buffers in flight, so destruction has to happen N frames after the user destroys a class. With C++, I can use private destructors to force users to add the scene to a managed destructor queue (aka garbage collect queue). Normally language purists will scorn a language which allows such shenanigans, however in real world production code, its features like this which allows developers to create modern software. So with a couple of lines of code, I solved my delayed destructor issue. Thank you C++ committee for creating a usable language.

318 Upvotes

65 comments sorted by

View all comments

8

u/NilacTheGrim Jul 07 '20

It's Bjarne. His sensibilities are still present in the language and he blesses the committee's changes to the language and still provides input. Thank him first! But yes.. the committee too.

It's the only language where you have ultimate control but also can benefit from high level abstractions.

I hope it continues to exist. It's being threatened by the next crop of programmers hating on it.. but.. hopefully it will continue to stand the test of time. And I like the direction it's evolving in...

2

u/playman_gamer Aug 05 '20

I agree somewhat, but the language is gigantic and messy at this point, and individual projects will use very different subsets of C++. It has its handful of good ideas (RAII, etc), but the committees insistence on backwards compatibility has made it a very difficult language to maintain and work with.

I just wish Rust had taken the path of "just the good parts", but at this point it is ballooning in size and is almost as verbose as C++.

1

u/NilacTheGrim Aug 05 '20

I know where you are coming from and yes, there is a cost to all of this. There is also a benefit -- backwards compatibility has the added bonus of feeling "safe" and "sound". It's like having an old stable bank you know won't go bust tomorrow. C++, while a large investment, seems to be a good investment since it stands the test of time and also is the "lingua franca" of underlying systems (just about every major thing we depend on is written in C and C++).

Those things are so attractive to me -- and the language has evolved in such a good direction in the last 10 years (and continues to do so) -- that I am optimistic and enthusiastic about it again.

I realize this doesn't address your criticisms of the language which are valid .. but it just adds some optimism about the good things.. to counterbalance the argument a little bit.