「C++/Guidelines/定数はconst宣言する/Code」の編集履歴(バックアップ)一覧はこちら
追加された行は緑色になります。
削除された行は赤色になります。
//cpp/linenumber
// 良くない例
#define PI 3.14
const double pi = 3.14;
const char * const name = "hoge";
const std::string language("cpp");
class hoge {
static const int num = 3;
};
class foo {
enum { num = 3 };
};
class bar {
static const double rate;
};
const double foo::rate = 2.1;
//cpp/linenumber
// 良くない例
#define PI 3.14
// 良い例
const double pi = 3.14;
const char * const name = "hoge";
const std::string language("cpp");
class hoge {
static const int num = 3;
};
class foo {
enum { num = 3 };
};
class bar {
static const double rate;
};
const double foo::rate = 2.1;