Table of Contents for Programming Languages: a survey
initializing things once:
e.g. in C++, if you have:
class A { public: A(int sz) { sz_ = sz; v = new B[sz_]; } ~A() { delete v; } ...private: ... B * v; int sz_; };
then sz_ is first implicitly initialized to its default value (0), and then it is set to sz in a second step.
But if you instead define the constructor as:
A(int sz) : v(new B[sz]), sz_(sz) {}
then sz_ will only be assigned to once.
e.g. "direct memory addressing"
and pointer arithmetic
In C, code like "int a = 41; a = a++" apparently compiles but leaves 'a' in an undefined state because "you can only update a variable once between sequence points" or it becomes undefined, but on many compilers works anyway. A sequence point is "a point in the program's execution sequence where all previous side effects SHALL have taken place and all subsequent side-effects SHALL NOT have taken place". the above paragraph are my words outside of quotes; quotes are from http://www.slideshare.net/olvemaudal/deep-c