#contents * 非POD型のメンバ変数は,可能な限りポインタにしない [#ra03fd43] (コンパイラの最適化がある程度賢いことが前提) 初期化忘れとdelete忘れを防ぐため, 可能な限りポインタを所持しない。 初期化忘れの例 #code(c,){{ #include <iostream> struct Vector3 { float x; float y; float z; void print() { std::cout << x << y << z << std::endl; } }; void func { Vector3 vec; vec.x = 1; vec.y = 0; vec.print(); // vec.zの初期化を忘れてる! } }} |