[Groonga-mysql-commit] mroonga/mroonga [fix-for-visual-studio] doc coding-style: add reasons about disabling assignment

Back to archive index

Kouhei Sutou null+****@clear*****
Thu Oct 4 10:39:01 JST 2012


Kouhei Sutou	2012-03-15 17:53:14 +0900 (Thu, 15 Mar 2012)

  New Revision: 96ac122e7f2d8d18ed573398f0535fa044ac7013
  https://github.com/mroonga/mroonga/commit/96ac122e7f2d8d18ed573398f0535fa044ac7013

  Log:
    doc coding-style: add reasons about disabling assignment

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

  Modified: doc/source/developer/coding_style.rst (+5 -1)
===================================================================
--- doc/source/developer/coding_style.rst    2012-03-15 17:51:24 +0900 (db8529d)
+++ doc/source/developer/coding_style.rst    2012-03-15 17:53:14 +0900 (71f783b)
@@ -301,7 +301,11 @@ TODO: ちゃんと考える。
 クラスの代入
 ------------
 
-基本的に定義したクラスの代入を禁止する。
+基本的に定義したクラスの代入を禁止する。よほどのことがなければ使用しないこと。
+
+代入演算子は暗黙的に無駄なコピーが発生する可能性があるためパフォーマンス上の問題がある。コピーではなくポインターやリファレンスを用いること。
+
+また、デフォルトの代入演算子の実装はメンバー変数のポインターの値をそのままコピーするため、デコンストラクターで二重に解放してしまう危険性がある。そのため、明示的に代入演算子を定義しない場合は無効にする。
 
 よい例:
 
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-mysql-commit mailing list
Back to archive index