Navigation Menu

Skip to content

Commit

Permalink
doc coding-style: add about naming rule for reader
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Mar 15, 2012
1 parent 65586d6 commit 11106f7
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions doc/source/developer/coding_style.rst
Expand Up @@ -197,3 +197,32 @@ TODO: ちゃんと考える。
char *my_name;
}
読み込み用アクセサ名
^^^^^^^^^^^^^^^^^^^^

メンバー変数の値を読み込むメソッドの名前はメンバー変数名の末尾のアンダースコアを除いたものにする。

よい例:

class MyClass
{
char *my_name_;
const char *my_name() {return my_name_;};
}
悪い例(末尾にアンダースコアが残っている):

class MyClass
{
char *my_name_;
const char *my_name_() {return my_name_;};
}
悪い例(先頭に ``get_`` を付けている):

class MyClass
{
char *my_name_;
const char *_my_name() {return my_name_;};
}

0 comments on commit 11106f7

Please sign in to comment.