3 ms·
As someone actively working on trying to modernize & improve a poorly-written legacy C++ code base, these are all great & easy to use points. #1 is great for c
by hermitdev 8y ago
As someone actively working on trying to modernize & improve a poorly-written legacy C++ code base, these are all great & easy to use points.
#1 is great for catching subtle bugs. Forget a const/volatile qualifier? override will catch it. inadvertently call for an int instead of a long? override will catch it.
#3 is great for readability. Especially when the type you're naming is complex. (I'm looking at you, Boost multi_index_container). The name comes first, the rest of the gobbledygook comes after what you're looking for.
#5 is great - no longer need to inherit from boost::noncopyable or explicitly mark compiler supplied constructors/operators as private. Clearer intent. In the same vane, using default for, well, defaults. I see so much code like `struct Foo{ Foo(){} };`. The default is clearer to me as far as intent.
#6 constexpr is valuable, but the example given in the video was kind of poor. It was already possible to get the array size using template metaprogramming at compile time in arguably simpler code than the example.
#9 chrono is pretty great, but it's support is spotty. It's also not exactly user-friendly. Key formatting APIs are missing in long term supported versions of GCC in major Linux distros. (I'm currently on Ubuntu 14.04 w/ GCC 4.8 and, for example, it's missing put_time). It's usage is pretty cumbersome. I haven't used it enough to have committed operations to memory, but things that would be 1 or 2 lines using Boost DateTime can be like 5-8 lines with chrono - not ideal.
Edit: minor spelling/grammar/intent changes