Navigation Menu

Skip to content

Commit

Permalink
doc coding-style: add about constant
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Mar 15, 2012
1 parent c8d570b commit 2548a74
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions doc/source/developer/coding_style.rst
Expand Up @@ -383,3 +383,16 @@ voidを省略
column.set_value(value);
}
}
定数
----

フラグやサイズなどを示す定数には ``const`` オブジェクトを用いる。これはデバッガー上でプログラムを走らせているときに名前で値を参照できるようにするためである。

よい例:

const char *MRN_LOG_FILE_PATH = "groonga.log";
悪い例( ``#define`` を用いている):

#define MRN_LOG_FILE_PATH "groonga.log"

0 comments on commit 2548a74

Please sign in to comment.