Tuesday, January 5, 2016

Bjarne Stroustrup - Writing Good C++14 @ CppCon 2015, 21 September 2015

For the 101 minutes video: https://www.youtube.com/watch?v=1OEu9C51K2A

For the C++ Core Gudilelines: https://github.com/isocpp/CppCoreGuidelines

For the Microsoft GSLhttps://github.com/isocpp/CppCoreGuidelines




Bjarne Stroustrup talks basically on the Guidelines Support Library (GSL). I took the following notes while watching the excellent talk:


02:55  Very few people write modern C++ code.

03:36

04:40  Inventing a new language in order get a better and simpler
       one is a bad idea!

08:50  We don't like coding rules. They are aimed to prevent 
       accidents: basically "don't do" lists. Not aimed for quality 
       code.

09:50  Coding rules recommends restrictions on C++ features.

10:00  There are a lot of bad advice!

11:58

12:07  I don't understand the MISRA C++ pointer rules: they are 
       miserable!

17:56  Language subsetting doesn't work.

18:15  Write high-level code via libraries using all the language 
       features.

19:10  After you build the superset, i.e. language + libraries, you 
       subset.

19:30  What we want is "C++ on steroids".  

23:40  Tool support, i.e. static analysis, is essential.

25:10  No resource leaks: RAII, i.e. no naked new and delete!

32:50  GSL: owner is for fixing the dangling pointer nightmare.

33:15  Owner is intended to simplify static analysis.

37:00  Besides dangling pointers, there are other pointer misuses:
       range errors: fix it with array_view.
       nullptr dereferencing: fix it with non_null.

37:18  We want to minimize run-time checks, because we want to run
       fast!

37:50  My least favorite interface:
       void f(int *p, int n);
       why?
       So common!
       So error-prone!
       Fix it with array_view.

40:15  nullptr problems: fix it with not_null.

41:30  not_null is for minimising run-time checking!

42:20  "Smart pointers" are overused to overcome ownership and 
       dangling pointer problems.

43:12  As the dangling pointers are eliminated by tools, you don't
       need to use them! 

47:30  Too many rules: the tools should know the rules and will 
       point you the relevant ones.

49:15  There are too many rules and it doesn't work me! I want lots 
       of rules.

50:00  I hate camel case.

51:20  We aren't unambitious: 
       Aim type and resource safety.
       Consider all 4+ millions C++ programmers.
       Zero-overhead principle.

51:50  We aim to change the way we write code.

53:52  Help wanted! There are currently only two editors: me and 
       Herb Sutter.

55:02  The basic C++ model is now complete.

57:20  Starts to answer the questions.



No comments: