[Groonga-mysql-commit] mroonga/mroonga [master] doc coding-style: add about constant

Back to archive index

null+****@clear***** null+****@clear*****
2012年 3月 15日 (木) 17:42:21 JST


Kouhei Sutou	2012-03-15 17:42:21 +0900 (Thu, 15 Mar 2012)

  New Revision: 2548a74b9cca3c59dc643766935205870c8a6b50

  Log:
    doc coding-style: add about constant

  Modified files:
    doc/source/developer/coding_style.rst

  Modified: doc/source/developer/coding_style.rst (+13 -0)
===================================================================
--- doc/source/developer/coding_style.rst    2012-03-15 17:39:18 +0900 (d55c592)
+++ doc/source/developer/coding_style.rst    2012-03-15 17:42:21 +0900 (50a088c)
@@ -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"




Groonga-mysql-commit メーリングリストの案内
Back to archive index