Kouhei Sutou
null+****@clear*****
Thu Oct 4 10:48:40 JST 2012
Kouhei Sutou 2012-03-15 17:39:18 +0900 (Thu, 15 Mar 2012) New Revision: c8d570bc3ce91f89796a86be31443e9f0c246cee https://github.com/mroonga/mroonga/commit/c8d570bc3ce91f89796a86be31443e9f0c246cee Log: doc coding-style: add about const Modified files: doc/source/developer/coding_style.rst Modified: doc/source/developer/coding_style.rst (+29 -0) =================================================================== --- doc/source/developer/coding_style.rst 2012-03-15 17:16:57 +0900 (49888ff) +++ doc/source/developer/coding_style.rst 2012-03-15 17:39:18 +0900 (d55c592) @@ -354,3 +354,32 @@ voidを省略 return age_; }; } + +入力用引数にはconstを付ける +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +入力のみに用いる引数には ``const`` を付ける。 + +よい例: + + class Table + { + void insert(unsigned int id, const char *column_name, const char *value) + { + Record *record = records[i]; + Column *column = columns[column_name]; + column.set_value(value); + } + } + +悪い例(入力のみに用いているのに ``const`` が付いていない): + + class Table + { + void insert(unsigned int id, char *column_name, char *value) + { + Record *record = records[i]; + Column *column = columns[column_name]; + column.set_value(value); + } + } -------------- next part -------------- HTML����������������������������...Download