If you try to just 'hack' something in which gets the right result,
you'll end up being burned by other changes along the way. /Charles Bloom/
You should think of every function you write as a 'service' which is
provided to the coders (even if that coder is you). /Charles Bloom/
Throughout the development process you need to be able to change your
algorithms quickly, and too much early optimization can lock you down
in a bad technique. /Charles Bloom/
Leaving classes the freedom to change is very very important. It lets
you change your mind about the implementation later if you need to,
which is almost always the case. /Charles Bloom/
Modularization is key to efficient development. It allows one programmer
to work on a module of the code base without breaking or involving other
sections. /Charles Bloom/
20% of the code takes 80% of
the execution time (hence, optimize it!), while 80% of the code should
just be written for clarity and ease of maintenance. /Donald Knuth/
Premature optimalization is the root of all evil. /Donald Knuth/
On the other hand we cannot ignore efficiency. /Jon Bentley/
A copy constructor is used to initialize an object with a different
object of the same type.
/Scott Meyers/
Probably the most important use of the copy constructor is to define
what it means to pass and return objects by value.
/Scott Meyers/
Pass-by-value means 'call the copy constructor.'
/Scott Meyers/
An object's initialization occurs when it is given a value for the
very first time.
/Scott Meyers/
Object assignment occurs when an object that is already initialized
is given a new value.
/Scott Meyers/
The difference between initialization and assignment is that the
former is performed by a constructor while the latter is performed
by operator=.
/Scott Meyers/
Static members are initialized to 0 by default.
/Scott Meyers/
Constructors usually have to check their arguments for validity,
whereas most assignment operators can take it for granted that
their argument is legitimate.
/Scott Meyers/
Copying is always based on an object's static type. /Scott Meyers/
When you call a virtual function, the function invoked is the one in the
class closest to the dynamic type of the object invoking the function.
/Scott Meyers/
Exception objects are always copied; when caught by value, they are
copied twice. /Scott Meyers/
Never put a catch clause for a base class before a catch clause for a
derived class. /Scott Meyers/
If you can write a constructor which uses only the initializer list, then
you can declare it inline.
/Charles Bloom/
Any C++ construct that can be called with the function call syntax is
a function object.
Virtual inheritance means that the parent data is accessed by a pointer
instead of being embedded directly. /Charles Bloom/
When a virtual function is called from a destructor, the function called
is the function for the class currently being destroyed.
/Scott Meayers/
Private inheritance is purely an implementation technique.
/Scott Meayers/
Multiple inheritance is ok-good for pure virtual 'interface' classes.
/Charles Bloom/
The fact that auto_ptrs hold exclusive ownership and can also be
copied leads to significant design challenges. /Scott Meayers/
In the case of VC++, pointer-to-member-function can be 4, 8, 12,
or 16 bytes in size, depending on what the compiler knows about
the class when the PMF is declared.