“Safe C++ Subset” Is Vapourware

  • Thread starter Thread starter pingu
  • Start date Start date
Ok, I'll bite

There is a kind of developer who likes to take the WRONG DESIGN and then program it in C++ and then tell us what's wrong. I see this on a regular basis. Shows a lack of analytic thinking.

You have fallen into his trap.
Code:
unique_ptr<int> p;
void foo(const int& v) {
  p = nullptr;
  cout << v;
}
void bar() {
  p = make_unique(7);
  foo(*p);
}

In the current case, std::unique_ptr() is the wrong tool. It was not built for that purpose.
Use shared_ptr.
Recommended usage of std::unique_ptr
So, to use std::unique_ptr() define it in a scope!!! and stop the messing by trying to conjure up crap examples.
 
Last edited:
If schools start graduating people with rust experience, the writing is on the wall for C++. Shifting school curriculum takes a big reason. Maybe a hit indie game, maybe some other killer app. I don't think servo is the one.

Now we know why.

Yawn
 
Last edited:
Back
Top Bottom