Navigation Menu

Skip to content

Commit

Permalink
doc coding style: add about include guard
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Mar 19, 2012
1 parent db8d4b9 commit 191f4d8
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions doc/source/developer/coding_style.rst
Expand Up @@ -90,6 +90,36 @@ TODO: 読みやすさの他にデバッグのしやすさ(gdbでの追いや
ha_mroonga.cpp:
using namespace zmq;

``include`` ガード
------------------

2重 ``include`` を防ぐためのマクロは、ヘッダーファイルの名前をすべて大文字にし、単語の区切りをアンダースコアにしたものにし、最後にアンダースコアをつけて ``HEADER_FILE_NAME_HPP_`` という名前にする。

よい例:

mrn_db_path.hpp:
#ifndef MRN_DB_PATH_HPP_
#define MRN_DB_PATH_HPP_
...
#endif // MRN_DB_PATH_HPP_

悪い例(小文字になっている):

mrn_db_path.hpp:
#ifndef mrn_db_path_hpp_
#define mrn_db_path_hpp_
...
#endif // mrn_db_path_hpp_

悪い例(アンダースコアが最後ではなく先頭についている):

mrn_db_path.hpp:
#ifndef _MRN_DB_PATH_HPP
#define _MRN_DB_PATH_HPP
...
#endif // _MRN_DB_PATH_HPP


文字列
------

Expand Down

0 comments on commit 191f4d8

Please sign in to comment.