Record learning, easy to view later.
I read this book in 2014-12-28, but how much did I do? It does have a part
0 don't stick to the bars
1 cleanly compile at high warning level without any warning
2 using the Automatic build system
3 using the version control system VCs
4 Investing in code reviews, communicating with people
51 entities should have only one compact responsibility (solve only one problem at a time)
6 correct, simple and clear first
7 programming should know when and how to consider scalability (linear algorithm first)
8 do not perform immature optimizations
9 do not perform premature deterioration.
10 minimizing global and shared data
11 Hiding information (do not expose internal information for abstract entities)
12 know when and how to do concurrency programming (multithreading)
13 Ensure that resources are owned by an object, using explicit Raii and smart pointers
14 Ning to compile-time and connection-time errors and do not run-time errors
15 Active use of const
16 Avoid using macros
17 Avoid using "magic number" (3.1415, etc.)
18 declaring variables as locally as possible
19 Always initialize variables
20 Avoid too long a function, avoid nesting too deep
21 avoiding the initialization of cross-compilation units
22 minimizing the definition of dependency and avoiding cyclic dependence
23 header files should be self-sufficient to compile each header file independently
24 always write an internal # include protector, never write an external #include保护符 (conditional compilation)
25 correctly choose to pass parameters by value, (SMART) pointer, or by reference
26 maintaining the natural semantics of overloaded operators
27 precedence using the standard form of arithmetic operators and assignment operators
28 preferential use of the standard form of + + and--preferred prefix form
29 consider overloading to avoid implicit type conversions
30 Avoid overloading &&, | |, or,
31 do not write code that relies on the order of the function parameter evaluation
32 figure out what kind of code to write (such as value class, base class, policy class, exception class)
33 replacing giant classes with small classes
34 replacing inheritance with combinations
35 avoid inheriting from classes that are not designed to be base classes
36 preference for abstract interfaces (dependency inversion principle dependency inversion Principle,dip)
37 common inheritance can be substituted, inheritance is not for reuse, but for reuse
38 Implementing a secure Overwrite (never modify default parameters)
39 Consider declaring a virtual function as non-pooled, declaring a shared function as non-virtual (non-virtaual Interface,nvi)
40 to avoid providing implicit conversions, you can provide a display transform (explicit) or a named conversion function
41 excluding data members to private, non-behavioral aggregation (c language struct)
42 do not expose internal data (avoid returning handles to internal data managed by the class)
43 Use Pimpl wisely (make private members inaccessible and invisible)
44 prioritizing non-member non-friend functions
45 always provide new and delete together
46 If you provide class-specific new, you should provide all standard forms (normal, in-place and non-throwing)
47 defining and initializing variables in the same order
48 using initialization instead of assignment in constructors
49 avoid calling virtual functions in constructors and destructors
50 set the base class destructor to be pooled and virtual, or protected and non-virtual
51 destructors, releases, and interchanges must never fail
521 for reproduction and destruction
53 to explicitly enable or disable replication
54 Avoid slicing, consider cloning instead of replication in the base class
55 using the standard form of assignment
56 to be viable, provide a swap that will not fail (and provide it correctly)
57 Place the type and its non-member function interfaces in the same namespace (Argument-dependent lookup, ADL, parameter dependent lookup)
58 The types and functions should be placed in separate namespaces, unless they are intended to work together
59 do not write namespace using before header file or # include
60 to avoid allocating and freeing memory in different modules (smart pointer shared_ptr)
61 do not define entities with links in the header file
62 do not allow exceptions to propagate across module boundaries
63 using a well-portable type in the interface of the module
64 The combination of rational static polymorphism and dynamic polymorphism
65 Intentional Display Customization
66 do not special function templates
67 Do not unintentionally write code that is not generic
68 widely used assertions to record internal assumptions and invariant
69 Establish a reasonable error handling strategy, and strictly abide by
70 distinguishing errors and non-errors
71 Designing and writing error security codes
72 Priority Use Exception Report error
73 by value throw, by reference capture
74 correct reporting, processing and conversion errors
75 avoiding the use of exception specifications
76 use vectors by default, otherwise, select the appropriate container
77 replacing arrays with vectors and strings
78 exchanging data with non-C + + APIs using vectors and STRING::C_STR
79 only values and smart pointers are stored in the container
80 ways to replace other extended sequences with push_back
81 multi-use return operation, less single element operation
82 using the accepted idiom real compression capacity (swap), the real deletion element (Erase_remove)
83 using an STL implementation with inspection
84 using algorithm calls instead of hand-written (lambda expressions)
85 using the correct STL lookup algorithm (unordered find/find_if or count/count_if, ordered Lower_bound/upper_bound/equal_range/binary_search)
86 using a positive-deterministic STL sorting algorithm (overhead from small to large partition ()->stable_partition ()->nth_element ()->partial_sort ()->sort () Stable_sort ())
87 make a predicate a pure function (predicate is a function object that returns a value of type bool)
88 algorithm and Comparator parameters multi function object less function
89 correctly write function objects (integrate as much as possible into unary_function or binary_function)
90 Avoid using type branching, multi-modal
91 dependency type, not how it is expressed
92 avoiding the use of reinterpret_cast
93 Avoid using static_cast with pointers (dynamic_cast replacement available)
94 Avoid Casting const
95 do not use C-style casts
96 do not perform memcpy operations or MEMCMP operations on non-pod
97 do not use joint re-interpretation representations
98 do not use variable length parameters (...). )
99 do not use invalid objects, do not use unsafe functions
100 do not polymorphic processing of arrays
I read this book in 2014-12-28, but how much did I do?
C + + Programming specification (101 guidelines)