• Forum
  • Lounge
  • “10 Core Guidelines You Need to Start

 
“10 Core Guidelines You Need to Start Using Now”

Talk from Kate Gregory at CppCon 2017 - not for beginners
https://www.youtube.com/watch?v=XkDEzfpdcSg
Since some people don't enjoy videos, the slides are here:
https://goo.gl/9JWhnZ

The selected guidelines are:
- C.45: Don't define a default constructor that only initializes data members; use in-class member initializers instead.
- C.48: Prefer in-class initializers to member initializers in constructors for constant initializers
- F.51: Where there is a choice, prefer default arguments over overloading.
- C.47: Define and initialize member variables in the order of member declaration.
- I.23: Keep the number of function arguments low
- ES.50: Don't cast away const.
- I.11: Never transfer ownership by a raw pointer (T*)
- F.21: To return multiple "out" values, prefer returning a tuple or struct.
- Enum.3: Prefer class enums over "plain" enums
- I.12: Declare a pointer that must not be null as [gsl::] not_null.
Other working titles:
* These 10 core guidelines will BLOW YOUR MIND!!!
* 10 core guidelines the Standard Committee doesn't want you to know!
You won't BELIEVE no. 3!!!

(Ugh. I feel dirty now.)
I watched this one by Kate:

https://isocpp.org/blog/2017/12/kate-gregory-its-complicated-meeting-cpp-2017-center-keynote

In this video, the original code was terrible , thousands of lines long, started with a goto label followed by 3 nested while(true) loops. After it was rewritten with RAII, it was 1 page long, easy to understand, maintain, and all the bugs went away.
Registered users can post here. Sign in or register to post.