Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You can do lots of modern c++ with C++98...mostly with a few things like move construction/assignment thrown in.

A lot of it is using the type system to help you or better describe your intent. Putting your values invariants into it's type means we can guarantee them and not forget.

Use RAII. This is the biggest and it has been here since the beginning.

Yeah, the old polymorphic class hierarchies can be tough. Who owns this pointer I have right now? One hopes the library takes ownership, but a pointer type doesn't have that invariant or ownership. This is where unique_ptr really shines. Also, one can create a type like poly_value<Base> that can be a Base or Child of Base and then treat it like a value with copies and all if the currently held type supports it.

But yeah, lots of people are working with 20 year old code and can at best do boyscout rule to clean up what they touch. There are a lot cppcon/c++now like talks about working with these.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: