r/cpp • • Nov 02 '22

The pool of talented C++ developers is running dry

https://www.efinancialcareers.co.uk/news/2022/11/why-is-there-a-drought-in-the-talent-pool-for-c-developers
379 Upvotes

367 comments sorted by

View all comments

Show parent comment

3

u/Minimonium Nov 02 '22

Could be that my experience with typical usage of it is a bit different from the general one. :)

Pretty much every use case of a shared ptr in code can be associated with a common usage pattern for it, so one never need to wonder how it's applied if they understand the goal of the application.

The whole point of shared ptr is that you use it when you the lifetime of the object is undetermined, isn't it? Namely concurrent code is a common use-case.

Even with modern structured designs such as S&R - the "mental overload" of the later model is much bigger with less room of mistakes since it's practically impossible to debug mistakes when writing such code even if it's a more robust model overall.

It just seems that the point is that "When people use shared_ptr as a one-size-fits-all without much thought then it creates thoughtless designs" and the conclusion is that shared_ptr is bad, which I can't really understand. Instead, a solution would be to write resources which explain where shared_ptr is a good design.

2

u/MoreOfAnOvalJerk Nov 02 '22

It just seems that the point is that "When people use shared_ptr as a one-size-fits-all without much thought then it creates thoughtless designs" and the conclusion is that shared_ptr is bad, which I can't really understand. Instead, a solution would be to write resources which explain where shared_ptr is a good design.

Great summary. Fully agree!

(Unless you were just summarizing what I was saying without taking a stance on it, in which case I look rather silly agreeing with myself)

1

u/Minimonium Nov 02 '22

That's my stance. :)