<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="styleguide.xsl"?>
<!--<GUIDE title="Google C++ Style Guide">-->
<GUIDE title="Google C++スタイルガイド 日本語訳">
<div align="center">
<!-- r22 -->
これは<a href="http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml">Google C++ Style Guide (3.133)</a>の日本語訳です。<br/><a href="http://dev.perl.org/licenses/">Artistic License/GPL</a>で配布します。<br/>最終更新: 2009-03-30
</div>

<p align="right">

Revision 3.133
</p>



<address>
Benjy Weinberger<br/>
Craig Silverstein<br/>
Gregory Eitzmann<br/>
Mark Mentovai<br/>
Tashana Landray<br/>
（日本語訳 <a href="http://www.textdrop.net/">Takashi Sasai</a>）
</address>

<OVERVIEW>
<!--
<CATEGORY title="Important Note">
-->
<CATEGORY title="重要な注意">
<!--
  <STYLEPOINT title="Displaying Hidden Details in this Guide">
-->
  <STYLEPOINT title="詳細情報の表示">
     <SUMMARY>
<!--
       This style guide contains many details that are initially
       hidden from view.  They are marked by the triangle icon, which you
       see here on your left.  Click it now.
       You should see "Hooray" appear below.
-->
       このスタイルガイドには詳細情報がたくさん含まれているが、最初は表示されていない。左端にある矢印ボタンをクリックしてみよう。
       「やったね」と表示されるはずだ。
     </SUMMARY>
     <BODY>
       <p>
<!--
        Hooray!  Now you know you can expand points to get more
        details.  Alternatively, there's an "expand all" at the
        top of this document.
-->
        やったね! このように矢印ボタンをクリックすると詳細情報が表示される。
        このドキュメントの先頭にある大きな矢印ボタンをクリックしてもいい。詳細情報が全部表示される。
       </p>
     </BODY>
  </STYLEPOINT>
</CATEGORY>
<!--<CATEGORY title="Background">-->
<CATEGORY title="背景">
  <p>
<!--
    C++ is the main development language
    
    used by many of Google's open-source
    projects.
    As every C++ programmer knows, the language has many powerful features,
    but this power brings with it complexity, which in turn can make code
    more bug-prone and harder to read and maintain.
-->
    C++は、Googleのオープンソースプロジェクトの多くで使われている主要な開発言語だ。
    C++プログラマなら誰でも知っているように、C++には強力な機能がたくさんあるが、その力ゆえに複雑になってしまっている。コードはバグを生みやすく、読みにくくメンテナンスしにくくなるおそれがある。
  </p>
  <p>
<!--
    The goal of this guide is to manage this complexity by describing
    in detail the dos and don'ts of writing C++
    code. These rules exist to
    keep
    
    the
    code base manageable while still allowing coders to use C++ language
    features productively.
-->
    このガイドの目標は、C++コードを書くときにすべきことすべきでないことを詳しく説明することで、C++にある複雑さを何とかしようというものだ。ここに挙げたルールは、C++の機能を利用して生産性を上げながらも、コードベースを管理可能にしておくためにある。
  </p>
  <p>
<!-- 
    <em>Style</em>, also known as readability, is what we call the
    conventions that govern our C++ code. The term Style is a bit of a
    misnomer, since these conventions cover far more than just source
    file formatting.
-->
  </p>
    <em>スタイル</em>とは読みやすさのことでもあり、C++コードに適用する規約を指している。ここで「スタイル」という用語を使うのは、やや語弊があるかもしれない。規約にはソースファイルの書式以上のものが含まれているためだ。
  <p>
<!--
    One way in which we keep the code base manageable is by enforcing
    <em>consistency</em>.
    
    It is very important that any
    
    programmer
    be able to look at another's code and quickly understand it.
    Maintaining a uniform style and following conventions means that we can
    more easily use "pattern-matching" to infer what various symbols are
    and what invariants are true about them. Creating common, required
    idioms and patterns makes code much easier to understand.  In some
    cases there might be good arguments for changing certain style
    rules, but we nonetheless keep things as they are in order to
    preserve consistency.
-->
    コードベースを管理可能にする方法の1つは、強制的に<em>一貫性</em>を持たせることだ。どんなプログラマでもコードを見ればすぐに理解できる、ということは極めて重要なことだ。
    みんなが一貫性のあるスタイルを維持して規約に従うと、簡単な「パターンマッチング」によって、各種シンボルが何を意味していて、どの不変式が真であるのか、推測できるようになる。よく使うイディオムやパターンを作っておくと、コードは非常に理解しやすくなる。スタイルを曲げるのに十分な理由があるときもあるだろう。しかし、それでもなお、私たちは一貫性を維持するため、そのままにしている。
  </p>
  <p>
<!--
    Another issue this guide addresses is that of C++ feature bloat.
    C++ is a huge language with many advanced features. In some cases
    we constrain, or even ban, use of certain features. We do this to
    keep code simple and to avoid the various common errors and
    problems that these features can cause.  This guide lists these
    features and explains why their use is restricted.
-->
    このガイドが解決するもう1つの問題は、肥大化したC++の機能についてだ。
    C++は数多くの先進的な機能を備えた、巨大な言語だ。場合によっては、特定の機能を制限したり、禁止することまでしている。コードをシンプルにして、こうした機能によって引き起こされる間違いや問題を回避するためだ。このガイドではそのような機能を列挙して、なぜその使用を制限したのかについても説明する。
  </p>
  <p>
<!--    
    Open-source projects developed by Google
    conform to the requirements in this guide.
-->
    Googleによって開発されているオープンソースプロジェクトは、このスタイルガイドに従っている。
  </p>
  
  <p>
<!--
    Note that this guide is not a C++ tutorial: we assume that the
    reader is familiar with the language.
-->
    このガイドはC++のチュートリアルではないことに注意しよう。読者はC++をよく知っていることを想定している。
  </p>
</CATEGORY>
</OVERVIEW>

<!-- <CATEGORY title="Header Files">-->
<CATEGORY title="ヘッダファイル">
  <p>
<!--
    In general, every <code>.cc</code> file should have an associated
    <code>.h</code> file. There are some common exceptions, such as
    
    unittests
    and small <code>.cc</code> files containing just a <code>main()</code>
    function.
-->
    一般的に、すべての <code>.cc</code>ファイルには、対応する<code>.h</code>ファイルを用意するべきだ。ただし、ユニットテストや<code>main()</code>関数1つだけの小さな<code>.cc</code>ファイルなどはこの限りではない。
  </p>
  <p>
<!--
    Correct use of header files can make a huge difference to the
    readability, size and performance of your code.
-->
    ヘッダファイルを正しく使うと、コードの読みやすさ、サイズ、パフォーマンスを大きく改善することができる。
  </p>
  <p>
<!--
    The following rules will guide you through the various pitfalls of
    using header files.
-->
    以下のルールでは、ヘッダファイルを使うときの落とし穴について説明する。
  </p>

<!--  <STYLEPOINT title="The #define Guard">-->
  <STYLEPOINT title="#define ガード">
    <SUMMARY>
<!--
      All header files should have <code>#define</code> guards to
      prevent multiple inclusion.  The format of the symbol name
      should be
      <code><i>&lt;PROJECT&gt;</i>_<i>&lt;PATH&gt;</i>_<i>&lt;FILE&gt;</i>_H_</code>.
-->
      多重インクルードを防ぐために、ヘッダファイルには <code>#define</code>ガードを入れておくべきだ。シンボル名は
      <code><i>&lt;PROJECT&gt;</i>_<i>&lt;PATH&gt;</i>_<i>&lt;FILE&gt;</i>_H_</code> という書式にするべきだ。
    </SUMMARY>
    <BODY>

      <p>
<!--      
        To guarantee uniqueness, they should be based on the full path
        in a project's source tree.  For example, the file
        <code>foo/src/bar/baz.h</code> in project <code>foo</code> should
        have the following guard:
-->
        シンボル名が一意であることを保証するために、シンボル名はプロジェクトのソースツリーのフルパスに基づいたものにするべきだ。例えば、<code>foo</code> というプロジェクトの <code>foo/src/bar/baz.h</code> というファイルの場合、#define ガードは次のようになる。
      </p>
      <CODE_SNIPPET>
         #ifndef FOO_BAR_BAZ_H_
         #define FOO_BAR_BAZ_H_

         ...

         #endif  // FOO_BAR_BAZ_H_
      </CODE_SNIPPET>
      
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Header File Dependencies">-->
  <STYLEPOINT title="ヘッダファイルの依存関係">
    <SUMMARY>
<!--
        Don't use an <code>#include</code> when a forward declaration
        would suffice.
-->
        前方宣言で十分なときには、<code>#include</code> を使ってはいけない。
    </SUMMARY>
    <BODY>
      <p>
<!--
        When you include a header file you introduce a dependency that
        will cause your code to be recompiled whenever the header file
        changes. If your header file includes other header files, any
        change to those files will cause any code that includes your
        header to be recompiled.  Therefore, we prefer to minimize
        includes, particularly includes of header files in other
        header files.
-->
        ヘッダファイルをインクルードすると依存関係ができて、そのヘッダファイルを変更するたびに再コンパイルが必要になる。あなたの書いたヘッダファイルが他のヘッダファイルをインクルードしているとしよう。インクルードしているヘッダファイルを変更すると、あなたのヘッダファイルをインクルードしている他のコードもすべて再コンパイルが必要になる。そのため、インクルードするのは最小限にしておくことが望ましい。特にヘッダファイル中で他のヘッダファイルをインクルードするのは避けよう。
      </p>
      <p>
<!--
        You can significantly minimize the number of header files you
        need to include in your own header files by using forward
        declarations.  For example, if your header file uses the
        <code>File</code> class in ways that do not require access to
        the declaration of the <code>File</code> class, your header
        file can just forward declare <code>class File;</code> instead
        of having to <code>#include "file/base/file.h"</code>.
-->
        前方宣言を使うと、ヘッダファイル中でインクルードするヘッダファイルの数をかなり減らすことができる。例えばヘッダファイルで <code>File</code> クラスを使っていても <code>File</code> クラスの宣言にアクセスする必要がないのであれば、ヘッダファイルには <code>class File;</code> と前方宣言するだけで十分だ。<code>#include "file/base/file.h"</code> とする必要はない。
      </p>
      <p>
<!--
        How can we use a class <code>Foo</code> in a header file
        without access to its definition?
-->
        <code>Foo</code> クラスの定義にアクセスせずに、そのヘッダファイルでは <code>Foo</code>クラスをどのように利用できるのか？
      </p>
      <ul>
<!--
        <li> We can declare data members of type <code>Foo*</code> or
             <code>Foo&amp;</code>.
-->
        <li> <code>Foo*</code> 型や <code>Foo&amp;</code> 型のデータメンバを宣言することができる。
             </li>
<!--
        <li> We can declare (but not define) functions with arguments,
             and/or return values, of type <code>Foo</code>.
             </li>
-->
        <li> <code>Foo</code> 型の引数や戻り値を持つ関数を宣言（定義ではない）することができる。
             </li>
<!--
        <li> We can declare static data members of type
             <code>Foo</code>.  This is because static data members
             are defined outside the class definition.
             </li>
-->
        <li> <code>Foo</code> 型のスタティックデータメンバを宣言することができる。スタティックデータメンバはクラス定義の外部に定義されるためだ。
             </li>
      </ul>
      <p>
<!--
        On the other hand, you must include the header file for
        <code>Foo</code> if your class subclasses <code>Foo</code> or
        has a data member of type <code>Foo</code>.
-->
        これに対して、書いているクラスが <code>Foo</code> のサブクラスであったり、そのクラスに <code>Foo</code> 型のデータメンバがあるのなら、<code>Foo</code> のヘッダファイルをインクルードしなければならない。
      </p>
      <p>
<!--
        Sometimes it makes sense to have pointer (or better,
        <code>scoped_ptr</code>)
        members instead of object members. However, this complicates code
        readability and imposes a performance penalty, so avoid doing
        this transformation if the only purpose is to minimize includes
        in header files.
-->
        メンバとしてオブジェクトではなくポインタ（<code>scoped_ptr</code> の方が望ましい）を持たせる方が理にかなっている場合もある。しかしこうすると、コードは読みにくくなり、パフォーマンス面でも不利になる。もしヘッダファイルのインクルードを最小限にすることだけが目的であれば、こうした置き換えをするのは避けること。
      </p>
      <p>
<!--
        Of course, <code>.cc</code> files typically do require the
        definitions of the classes they use, and usually have to
        include several header files.
-->
        言うまでもないことだが、通常 <code>.cc</code> ファイルには利用するクラスの定義が必要になるため、ヘッダファイルをインクルードする必要がある。
      </p>
      
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Inline Functions">-->
  <STYLEPOINT title="インライン関数">
    <SUMMARY>
<!--
      Define functions inline only when they are small, say, 10 lines
      or less.
-->
      インライン関数を定義するのは関数が小さいときのみ（10行以下）にする。
    </SUMMARY>
    <BODY>
      <DEFINITION>
<!--
        You can declare functions in a way that allows the compiler to
        expand them inline rather than calling them through the usual
        function call mechanism.
-->
        コンパイラが通常の関数呼び出しメカニズムで呼び出すのではなくインライン関数として展開するよう、関数を宣言することができる。
      </DEFINITION>
      <PROS>
<!--
        Inlining a function can generate more efficient object code,
        as long as the inlined function is small. Feel free to inline
        accessors and mutators, and other short, performance-critical
        functions.
-->
        インライン化される関数が小さければ、コンパイラは効率のよいオブジェクトコードを生成することができる。アクセサやミューテータ、短くてパフォーマンスに影響を及ぼす関数は遠慮なくインライン化すること。
      </PROS>
      <CONS>
<!--
        Overuse of inlining can actually make programs slower.
        Depending on a function's size, inlining it can cause the code
        size to increase or decrease.  Inlining a very small accessor
        function will usually decrease code size while inlining a very
        large function can dramatically increase code size.  On modern
        processors smaller code usually runs faster due to better use
        of the instruction cache.
-->
        インライン化しすぎると、実際にはプログラムが遅くなることがある。関数の大きさによってコードサイズが増えたり減ったりするためだ。ごく小さなアクセサ関数をインライン化すると通常はコードサイズが減る。しかし、巨大な関数をインライン化するとコードサイズが劇的に増えることがある。最新のプロセッサでは通常、コードが小さければ小さいほど高速に実行することができる。これは命令キャッシュの利用効率が上がるためだ。
      </CONS>
      <DECISION>
        <p>
<!--
          A decent rule of thumb is to not inline a function if it is
          more than 10 lines long. Beware of destructors, which are
          often longer than they appear because of implicit member-
          and base-destructor calls!
-->
          これについては優れた経験則がある。10行を超える関数はインライン化しないというものだ。ただしデストラクタには注意すること。見た目以上に長くなることがよくある。これは暗黙のうちに、メンバクラスのデストラクタとベースクラスのデストラクタが呼び出されるためだ。
        </p>
        <p>
<!--
          Another useful rule of thumb: it's typically not cost
          effective to inline functions with loops or switch
          statements (unless, in the common case, the loop or switch
          statement is never executed).
-->
          もう1つ役に立つ経験則がある。ループやスイッチ文のある関数をインライン化するのは割に合わない。（ただし、よく見かける実行されることのないループやスイッチ文の場合を除く）。
        </p>
        <p>
<!--
          It is important to know that functions are not always
          inlined even if they are declared as such; for example,
          virtual and recursive functions are not normally inlined.
          Usually recursive functions should not be inline.  The main
          reason for making a virtual function inline is to place its
          definition in the class, either for convenience or to
          document its behavior, e.g., for accessors and mutators.
-->
          たとえ関数をインライン化するよう宣言してあっても実際にインライン化されるとは限らない、ということを知っておくことは重要だ。例えば、仮想関数や再帰関数は通常インライン化されない。再帰関数は通常インライン化すべきではない。仮想関数をインライン化する主な理由は、仮想関数をクラスの定義に置くためだ。こうすると便利だから、あるいは、アクセサやミューテータなどの動作を明記できるためだ。
        </p>
      </DECISION>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="The -inl.h Files">-->
  <STYLEPOINT title="-inl.hファイル">
    <SUMMARY>
<!--
      You may use file names with a <code>-inl.h</code> suffix to define
      complex inline functions when needed.
-->
      複雑なインライン関数を定義するときには、必要に応じて <code>-inl.h</code>というサフィックスを持つファイルに書いてもよい。
    </SUMMARY>
    <BODY>
      <p>
<!--
        The definition of an inline function needs to be in a header
        file, so that the compiler has the definition available for
        inlining at the call sites.  However, implementation code
        properly belongs in <code>.cc</code> files, and we do not like
        to have much actual code in <code>.h</code> files unless there
        is a readability or performance advantage.
-->
        インライン関数の定義はヘッダファイルに入れておく必要がある。これにより、コンパイラはその定義を呼び出し場所に埋め込むことができる。しかし、実装コードはきちんと <code>.cc</code> ファイルに置いておくべきだ。読みやすさやパフォーマンスにメリットがない限り、実際のコードを<code>.h</code> ファイルにたくさん置くのは好ましくない。
      </p>
      <p>
<!--
        If an inline function definition is short, with very little,
        if any, logic in it, you should put the code in your
        <code>.h</code> file.  For example, accessors and mutators
        should certainly be inside a class definition.  More complex
        inline functions may also be put in a <code>.h</code> file for
        the convenience of the implementer and callers, though if this
        makes the <code>.h</code> file too unwieldy you can instead
        put that code in a separate <code>-inl.h</code> file.
        This separates the implementation from the class definition,
        while still allowing the implementation to be included where
        necessary.
-->
        もしインライン関数の定義が短くて、ロジックがほとんどないかあっても少しなら、<code>.h</code> ファイルにコードを入れておくべきだ。例えば、アクセサやミューテータは必ずクラス定義の内部に入れておくべきだ。もっと複雑なインライン関数であっても実装者や利用者にとって便利であれば、<code>.h</code> ファイルに置いても構わない。しかし、<code>.h</code> ファイルが大きくなりすぎて扱いにくければ、別の <code>-inl.h</code> ファイルにコードを入れてもいい。
        こうするとクラス定義から実装が分離されてしまうが、実装はきちんと必要な場所にインクルードされる。
      </p>
      <p>
<!--
        Another use of <code>-inl.h</code> files is for definitions of
        function templates.  This can be used to keep your template
        definitions easy to read.
-->
        <code>-inl.h</code> ファイルのもう1つの使い道は関数テンプレートの定義だ。テンプレートの定義を読みやすくしておくためにこのファイルを使うことができる。
      </p>
      <p>
<!--
        Do not forget that a <code>-inl.h</code> file requires a
        <a href="#The__define_Guard"><code>#define</code> guard</a> just
        like any other header file.
--> 
        <code>-inl.h</code> ファイルには <a href="#The__define_Guard"><code>#define</code> ガード</a>が必要だということを忘れないこと。これについては他のヘッダファイルと全く同じだ。
      </p>
      
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Function Parameter Ordering">-->
  <STYLEPOINT title="関数パラメータの順序">
    <SUMMARY>
<!--
      When defining a function, parameter order is: inputs,
      then outputs.
-->
      関数を定義するときには、パラメータの並び順は入力、出力とする。
    </SUMMARY>
    <BODY>
      <p>
<!--
        Parameters to C/C++ functions are either input to the
        function, output from the function, or both. Input parameters
        are usually values or <code>const</code> references, while output
        and input/output parameters will be non-<code>const</code>
        pointers. When ordering function parameters, put all input-only
        parameters before any output parameters.  In particular, do not add
        new parameters to the end of the function just because they are
        new; place new input-only parameters before the output
        parameters.
-->
        C/C++ 関数におけるパラメータは、関数への入力か、関数からの出力か、その両方であるかのいずれかだ。通常、入力パラメータは値か <code>const</code> リファレンスになる。これに対して、出力および入出力パラメータは非 <code>const</code> ポインタになるだろう。関数パラメータを並べるときには、出力パラメータの前に入力のみのパラメータをすべて置いておくこと。新しいパラメータだからといって、関数の最後に追加してはいけない。入力のみのパラメータを新しく追加するときには、出力パラメータの前に置くようにすること。
      </p>
      <p>
<!--
        This is not a hard-and-fast rule.  Parameters that are both
        input and output (often classes/structs) muddy the waters,
        and, as always, consistency with related functions may require
        you to bend the rule.
-->
        これは厳格なルールではない。入力でもあり出力でもあるパラメータ（クラスや構造体であることが多い）が存在するため、このルールはすっきりしていない。例によって、関連する関数に一貫性を持たせるためにルールを曲げる必要があるかもしれない。
      </p>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Names and Order of Includes">-->
  <STYLEPOINT title="インクルードの名前と順序">
    <SUMMARY>
<!--
      Use standard order for readability and to avoid hidden
      dependencies: C library, C++ library,
      
      other libraries' <code>.h</code>, your
      project's
      <code>.h</code>.
-->
      読みやすくするため、また依存関係が隠れてしまうのを避けるために、次の順序でインクルードする。
      Cライブラリ、C++ライブラリ、その他のライブラリの<code>.h</code>、プロジェクトの<code>.h</code>
    </SUMMARY>
    <BODY>
      <p>
<!--        
        All of a project's header files should be
        listed as descentants of the project's source directory
        without use of UNIX directory shortcuts <code>.</code> (the current
        directory) or <code>..</code> (the parent directory).  For
        example,
        
        <code>google-awesome-project/src/base/logging.h</code>
        should be included as
-->
        プロジェクトのヘッダファイルはすべて、プロジェクトのソースディレクトリ配下にあるものとして書くべきだ。UNIXディレクトリのショートカットである <code>.</code>（カレントディレクトリ）や <code>..</code>（親ディレクトリ）を使ってはいけない。例えば、
        <code>google-awesome-project/src/base/logging.h</code>
        をインクルードするときには、以下のようにする。
      </p>
      <CODE_SNIPPET>
        #include "base/logging.h"
      </CODE_SNIPPET>
      <p>
<!--
        In <code><var>dir/foo</var>.cc</code>, whose main purpose is
        to implement or test the stuff in
        <code><var>dir2/foo2</var>.h</code>, order your includes as
        follows:
-->
        <code><var>dir/foo</var>.cc</code> の主たる目的が
        <code><var>dir2/foo2</var>.h</code> にあるものを実装することであったり、テストすることであれば、<code><var>dir/foo</var>.cc</code> ではヘッダを次の順序でインクルードする。
      </p>
      <ol>
<!--
        <li> <code><var>dir2/foo2</var>.h</code> (preferred location
          &#8212; see details below).</li>
        <li> C system files.</li>
        <li> C++ system files.</li>
        <li> Other libraries' <code>.h</code> files.</li>
        <li> 
             Your project's
             <code>.h</code> files.</li>
-->
        <li> <code><var>dir2/foo2</var>.h</code> （望ましい場所
          &#8212; 詳しくは下を参照）。</li>
        <li> Cシステムファイル</li>
        <li> C++システムファイル</li>
        <li> その他ライブラリの <code>.h</code> ファイル</li>
        <li> 
             プロジェクトの <code>.h</code> ファイル</li>
      </ol>
      <p>
<!--
        The preferred ordering reduces hidden dependencies.  We want
        every header file to be compilable on its own.  The easiest
        way to achieve this is to make sure that every one of them is
        the first <code>.h</code> file <code>#include</code>d in some
        <code>.cc</code>.  
-->
        ここで推奨している順序にすると、依存関係が隠れてしまいにくくなる。私たちはすべてのヘッダファイルがそれだけでコンパイルできるようにしたい。これを実現するいちばん簡単な方法は、すべてのヘッダファイルを必ず <code>.cc</code> でインクルードされる最初の <code>.h</code> にしておくことだ。
      </p>
      <p>
<!--
        <code><var>dir/foo</var>.cc</code> and
        <code><var>dir2/foo2</var>.h</code> are often in the same
        directory (e.g. <code>base/basictypes_unittest.cc</code> and
        <code>base/basictypes.h</code>), but can be in different
        directories too.
-->
        <code><var>dir/foo</var>.cc</code> と <code><var>dir2/foo2</var>.h</code> は同じディレクトリに置いておくことが多い。（例えば <code>base/basictypes_unittest.cc</code> と <code>base/basictypes.h</code>）。しかし別のディレクトリに置いても構わない。
      </p>
      
      <p>
<!--
        Within each section it is nice to order the includes
        alphabetically.
-->
        それぞれのセクション内では、アルファベット順にインクルードしておくとよい。
      </p>
      <p>
<!--
        For example, the includes in
        
        <code>google-awesome-project/src/foo/internal/fooserver.cc</code>
        might look like this:
-->
        例えば、<code>google-awesome-project/src/foo/internal/fooserver.cc</code> のインクルードは次のようになる。
      </p>
      <CODE_SNIPPET>
        #include "foo/public/fooserver.h"  // Preferred location.

        #include &lt;sys/types.h&gt;
        #include &lt;unistd.h&gt;

        #include &lt;hash_map&gt;
        #include &lt;vector&gt;

        #include "base/basictypes.h"
        #include "base/commandlineflags.h"
        #include "foo/public/bar.h"
      </CODE_SNIPPET>
    </BODY>
  </STYLEPOINT>
</CATEGORY>

<!--<CATEGORY title="Scoping">-->
<CATEGORY title="スコープ">
<!--  <STYLEPOINT title="Namespaces">-->
  <STYLEPOINT title="名前空間">
    <SUMMARY>
<!--
      Unnamed namespaces in <code>.cc</code> files are encouraged.  With
      named namespaces, choose the name based on the
      
      project, and possibly its path.
      Do not use a <SYNTAX>using-directive</SYNTAX>.
-->
      <code>.cc</code> ファイルには無名の名前空間を使うことを推奨する。名前付き名前空間を使うときには、プロジェクト名と可能ならパス名に基づいた名前にする。
      <SYNTAX>using ディレクティブ</SYNTAX>を使ってはいけない。
    </SUMMARY>
    <BODY>
      <DEFINITION>
<!--    
        Namespaces subdivide the global scope into distinct, named
        scopes, and so are useful for preventing name collisions in
        the global scope.
-->
        名前空間はグローバルスコープを個別の名前の付いたスコープに分割する。これはグローバルスコープで名前の衝突が起こるのを避けるのに役立つ。
      </DEFINITION>
      <PROS>
        <p>
<!--
          Namespaces provide a (hierarchical) axis of naming, in
          addition to the (also hierarchical) name axis provided by
          classes.
-->
          名前空間はクラスによる（階層的な）名前の軸に加えて、（これもまた階層的な）名前の軸を提供する。
        </p>
        <p>
<!--
          For example, if two different projects have a class
          <code>Foo</code> in the global scope, these symbols may
          collide at compile time or at runtime.  If each project
          places their code in a namespace, <code>project1::Foo</code>
          and <code>project2::Foo</code> are now distinct symbols that
          do not collide.
-->
          例えば異なる2つのプロジェクトにおいて、どちらにもグローバルスコープに <code>Foo</code> というクラスがある場合、コンパイル時もしくは実行時にシンボルが衝突してしまうおそれがある。それぞれのプロジェクトの名前空間にコードを置いていれば、<code>project1::Foo</code> と <code>project2::Foo</code> という異なるシンボルになり衝突は起こらない。
        </p>
      </PROS>
      <CONS>
        <p>
<!--
          Namespaces can be confusing, because they provide an
          additional (hierarchical) axis of naming, in addition to the
          (also hierarchical) name axis provided by classes.
-->
          名前空間があると混乱するおそれがある。クラスによる名前の（階層的な）軸に加えて、さらに名前の（階層的な）軸を提供するためだ。
        </p>
        <p>
<!--
          Use of unnamed spaces in header files can easily cause
          violations of the C++ One Definition Rule (ODR).
-->
          ヘッダファイルに無名のスコープを使うと、C++の単一定義規則（ODR、One Definition Rule）に違反しやすくなる。
        </p>
      </CONS>
      <DECISION>
        <p>
<!--
          Use namespaces according to the policy described below.
-->
          名前空間を使うときには次に説明するポリシーに従うこと。
        </p>

<!--        <SUBSECTION title="Unnamed Namespaces">-->
        <SUBSECTION title="無名の名前空間">
          <ul>
<!--
            <li> Unnamed namespaces are allowed and even encouraged in
                 <code>.cc</code> files, to avoid runtime naming
                 conflicts:
-->
            <li> 実行時の名前の衝突を避けるために <code>.cc</code> ファイルには無名の名前空間を使ってもよい。むしろ使うことを推奨する。
                 <CODE_SNIPPET>
                   namespace {                           // .cc ファイルにおいて

                   // 名前空間の内容はインデントしない
                   enum { kUnused, kEOF, kERROR };       // 共通で使うトークン。
                   bool AtEof() { return pos_ == kEOF; }  // 名前空間のEOFを使う。

                   }  // namespace
                 </CODE_SNIPPET>

                 <p>
<!--
                   However, file-scope declarations that are
                   associated with a particular class may be declared
                   in that class as types, static data members or
                   static member functions rather than as members of
                   an unnamed namespace.  Terminate the unnamed
                   namespace as shown, with a comment <code>//
                   namespace</code>.
-->
                   しかし、特定のクラスに関連するファイルスコープ宣言は、無名の名前空間のメンバとしてではなく、型やスタティックデータメンバ、スタティックメンバ関数としてそのクラスに宣言してもよい。この例にあるように、無名の名前空間を終了するときには <code>// namespace</code> というコメントを入れておくこと。
                 </p>
                 </li>
<!--
            <li> Do not use unnamed namespaces in <code>.h</code>
                 files.
-->
            <li> <code>.h</code> ファイルには無名の名前空間を使ってはいけない。
                 </li>
          </ul>
        </SUBSECTION>

<!--        <SUBSECTION title="Named Namespaces">-->
        <SUBSECTION title="名前付き名前空間">
          <p>
<!--
            Named namespaces should be used as follows:
-->
            名前付き名前空間は次のようにすべきだ。
          </p>
          <ul>
<!--
            <li> Namespaces wrap the entire source file after includes,
                 
                 <a href="http://google-gflags.googlecode.com/">gflags</a>
                 definitions/declarations, and forward declarations of classes
                 from other namespaces:
-->
            <li> 名前空間には、インクルード、
                 <a href="http://google-gflags.googlecode.com/">gflags</a> 定義/宣言、他の名前空間にあるクラスの前方宣言をすべて包むようにする。
                 <CODE_SNIPPET>
                   // .h ファイルにおいて
                   namespace mynamespace {

                   // 宣言はすべて、名前空間のスコープ内にある。
                   // インデントのないことに注意すること。
                   class MyClass {
                    public:
                     ...
                     void Foo();
                   };

                   }  // namespace mynamespace
                 </CODE_SNIPPET>
                 <CODE_SNIPPET>
                   // .cc ファイルにおいて
                   namespace mynamespace {

                   // 関数定義は名前空間のスコープ内にある。
                   void MyClass::Foo() {
                     ...
                   }

                   }  // namespace mynamespace
                 </CODE_SNIPPET>
                 <p>
<!--
                   The typical <code>.cc</code> file might have more
                   complex detail, including the need to reference classes
                   in other namespaces.
-->
                   <code>.cc</code> ファイルは通常もっと複雑で、他の名前空間にあるクラスも参照する必要があるだろう。
                 </p>
                 <CODE_SNIPPET>
                   #include "a.h"

                   DEFINE_bool(someflag, false, "dummy flag");

                   class C;  // グローバルな名前空間におけるクラスCの前方宣言
                   namespace a { class A; }  // a::A の前方宣言

                   namespace b {

                   ...code for b...         // コードの左には余白を入れていない。

                   }  // namespace b
                 </CODE_SNIPPET>
                 </li>

            
<!--
            <li> Do not declare anything in namespace
                 <code>std</code>, not even forward declarations of
                 standard library classes.  Declaring entities in
                 namespace <code>std</code> is undefined behavior,
                 i.e., not portable.  To declare entities from the
                 standard library, include the appropriate header
                 file.
-->
            <li> 名前空間 <code>std</code> には何も宣言してはいけない。たとえ標準ライブラリに含まれるクラスの前方宣言であってもだ。名前空間 <code>std</code> に宣言したときの動作は定義されていない。つまり移植性がないということだ。標準ライブラリに含まれている要素を宣言するには、適切なヘッダファイルをインクルードすること。
                 </li>

<!--
            <li> You may not use a <SYNTAX>using-directive</SYNTAX> to
                 make all names from a namespace available.
-->
            <li> <SYNTAX>using ディレクティブ</SYNTAX> を使って、名前空間にある名前をすべて利用できるようにしてはいけない。
                 <BAD_CODE_SNIPPET>
                   // 禁止されている -- これは名前空間を汚染する。
                   using namespace foo;
                 </BAD_CODE_SNIPPET>
                 </li>
<!--
            <li> You may use a <SYNTAX>using-declaration</SYNTAX>
                 anywhere in a <code>.cc</code> file, and in functions,
                 methods or classes in <code>.h</code> files.
-->
            <li> <code>.cc</code> ファイルならどこでも、<code>.h</code> ファイルなら関数かメソッドかクラス内であれば、<SYNTAX>using ディレクティブ</SYNTAX> を使ってもよい。
                 <CODE_SNIPPET>
                   // .cc ファイルではOK。
                   // .h ファイルでは関数かメソッドかクラス内でなければならない。
                   using ::foo::bar;
                 </CODE_SNIPPET>
                 </li>
<!--
            <li> Namespace aliases are allowed anywhere in a
                 <code>.cc</code> file, and in functions and methods in
                 <code>.h</code> files.
-->
            <li> <code>.cc</code> ファイルならどこでも、<code>.h</code> ファイルなら関数かメソッド内であれば、名前空間のエイリアスを使ってもよい。
                 <CODE_SNIPPET>
                   // .cc ファイルではOK。
                   // .h ファイルでは関数かメソッド内でなければならない。
                   namespace fbz = ::foo::bar::baz;
                 </CODE_SNIPPET>
                 </li>
          </ul>
        </SUBSECTION>

        

        

        
      </DECISION>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Nested Classes">-->
  <STYLEPOINT title="ネストされたクラス">
    <SUMMARY>
<!--
      Although you may use public nested classes when they are part of
      an interface, consider a <a HREF="#Namespaces">namespace</a> to
      keep declarations out of the global scope.
-->
      もしそれがインタフェースの一部であるときには、パブリックなネストされたクラスを使ってもよい。しかし、グローバルスコープの外部に宣言するためであれば、<a HREF="#Namespaces">名前空間</a>の使用を検討すること。
    </SUMMARY>
    <BODY>
      <DEFINITION>
<!--
        A class can define another class within it; this is also
        called a <SYNTAX>member class</SYNTAX>.
-->
        クラスはその内部に別のクラスを定義することができる。これは <SYNTAX>メンバクラス</SYNTAX> と呼ばれることもある。
        <CODE_SNIPPET>
          class Foo {

           private:
            // Bar はメンバクラスであり、Fooの内部にネストされている。
            class Bar {
              ...
            };

          };
        </CODE_SNIPPET>
      </DEFINITION>
      <PROS>
<!--
        This is useful when the nested (or member) class is only used
        by the enclosing class; making it a member puts it in the
        enclosing class scope rather than polluting the outer scope
        with the class name.  Nested classes can be forward declared
        within the enclosing class and then defined in the
        <code>.cc</code> file to avoid including the nested class
        definition in the enclosing class declaration, since the
        nested class definition is usually only relevant to the
        implementation.
--> 
        ネストされたクラス（またはメンバクラス）は、それを囲んでいるクラスによってのみ使われるときに役立つ。そのクラスをメンバにすることによって、クラス名で外部のスコープを汚染することなく、囲んでいるクラスのスコープ内に留めることができる。ネストされたクラスは、それを囲んでいるクラス内部に前方宣言しておいて、<code>.cc</code> ファイルで定義してもよい。こうするとネストされたクラスの定義を入れなくて済む。ネストされたクラスの定義は通常、実装だけに関連しているためだ。
      </PROS>
      <CONS>
<!--
        Nested classes can be forward-declared only within the
        definition of the enclosing class. Thus, any header file
        manipulating a <code>Foo::Bar*</code> pointer will have to
        include the full class declaration for <code>Foo</code>.
-->
        ネストされたクラスはそれを囲んでいるクラスの定義の内部でのみ前方宣言することができる。したがって <code>Foo::Bar*</code> ポインタを操作するヘッダファイルにはみな、<code>Foo</code> のクラス宣言をすべて入れておく必要があるだろう。
      </CONS>
      <DECISION>
<!--
        Do not make nested classes public unless they are actually
        part of the interface, e.g., a class that holds a set of
        options for some method.
-->        
        実際にはインタフェースの一部でないときには、ネストされたクラスをパブリックにしてはいけない。例えば、メソッドのためのオプションを保持するクラスなどだ。
      </DECISION>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Nonmember, Static Member, and Global Functions">-->
  <STYLEPOINT title="非メンバ関数、スタティックメンバ関数、グローバル関数">
    <SUMMARY>
<!--
      Prefer nonmember functions within a namespace or static member
      functions to global functions; use completely global functions
      rarely.
-->
      グローバル関数を使うよりも、名前空間内の非メンバ関数やスタティックメンバ関数を使う方が望ましい。グローバル関数はめったに使ってはいけない。
    </SUMMARY>
    <BODY>
      <PROS>
<!--
        Nonmember and static member functions can be useful in some
        situations.  Putting nonmember functions in a namespace avoids
        polluting the global namespace.
-->
        非メンバ関数とスタティックメンバ関数が役に立つことがある。非メンバ関数を名前空間内に置くと、グローバルな名前空間の汚染を防ぐことができる。
      </PROS>
      <CONS>
<!--
        Nonmember and static member functions may make more sense as
        members of a new class, especially if they access external
        resources or have significant dependencies.
-->
        非メンバ関数とスタティックメンバ関数は新しいクラスのメンバとして使うなら理にかなっているだろう。特に外部リソースにアクセスしたり、大きな依存関係がある場合には意味がある。
      </CONS>
      <DECISION>
        <p>
<!--
          Sometimes it is useful, or even necessary, to define a
          function not bound to a class instance.  Such a function can
          be either a static member or a nonmember function.
          Nonmember functions should not depend on external variables,
          and should nearly always exist in a namespace.  Rather than
          creating classes only to group static member functions which
          do not share static data, use
          <a href="#Namespaces">namespaces</a> instead.
-->
          クラスのインスタンスに関連付けられていない関数を定義するのは役に立つこともあるし、時として必要になることもある。こうした関数はスタティックメンバ関数または非メンバ関数のいずれかにして構わない。
          非メンバ関数は外部変数に依存するべきではなく、ほとんどの場合、名前空間内に存在するようにすべきだ。スタティックデータを共有していないスタティックメンバ関数をまとめたいときには、そのためだけにクラスを作るのではなく、代わりに<a href="#Namespaces">名前空間</a>を使うべきだ。
        </p>
        <p>
<!--
          Functions defined in the same compilation unit as production
          classes may introduce unnecessary coupling and link-time
          dependencies when directly called from other compilation
          units; static member functions are particularly susceptible
          to this.  Consider extracting a new class, or placing the
          functions in a namespace possibly in a separate library.
-->
          クラスと同じコンパイル単位に定義されている関数を別のコンパイル単位から直接呼び出すと、コンパイル時やリンク時に不必要な依存関係ができるおそれがある。スタティックメンバ関数の場合、特にこうなることが多い。新しいクラスを抽出したり、できれば別のライブラリの名前空間に関数を置くことを検討すること。
        </p>
        <p>
<!--
          If you must define a nonmember function and it is only
          needed in its <code>.cc</code> file, use an unnamed
          <a HREF="#Namespaces">namespace</a> or <code>static</code>
          linkage (eg <code>static int Foo() {...}</code>) to limit
          its scope.
-->
          もし非メンバ関数を定義する必要があり、それが <code>.cc</code> ファイル内でのみ必要なら、無名の<a HREF="#Namespaces">名前空間</a>か <code>static</code> リンク （例えば <code>static int Foo() {...}</code>）を使ってスコープを制限すること。
        </p>
      </DECISION>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Local Variables">-->
  <STYLEPOINT title="ローカル変数">
    <SUMMARY>
<!--
      Place a function's variables in the narrowest scope possible,
      and initialize variables in the declaration.
-->
      関数内で使う変数はできるだけスコープを限定し、宣言時に変数を初期化しておく。
    </SUMMARY>
    <BODY>
      <p>
<!--
        C++ allows you to declare variables anywhere in a function.
        We encourage you to declare them in as local a scope as
        possible, and as close to the first use as possible. This
        makes it easier for the reader to find the declaration and see
        what type the variable is and what it was initialized to.  In
        particular, initialization should be used instead of
        declaration and assignment, e.g.
-->
        C++では関数内のどこでも変数を宣言することができる。私たちはできるだけスコープを局所的にして、できるだけ初めて使う場所の近くで宣言することを推奨する。こうしておくとコードを読む人にとって、その変数の型が何であり、それがどう初期化されているのかが見つけやすくなる。具体的には、宣言や代入などを使う代わりに初期化を使うべきだ。
      </p>
      <CODE_SNIPPET>
        int i;
        i = f();      // よくない -- 初期化が宣言と分離している。
        int j = g();  // よい -- 宣言で初期化されている。
      </CODE_SNIPPET>
      <p>
<!--
        Note that gcc implements <code>for (int i = 0; i
        &lt; 10; ++i)</code> correctly (the scope of <code>i</code> is
        only the scope of the <code>for</code> loop), so you can then
        reuse <code>i</code> in another <code>for</code> loop in the
        same scope.  It also correctly scopes declarations in
        <code>if</code> and <code>while</code> statements, e.g.
-->
        gcc は <code>for (int i = 0; i &lt; 10; ++i)</code> を正しく実装していることに注意しよう。(<code>i</code> のスコープは <code>for</code> ループ内だけになる)。そのため、同じスコープにある別の <code>for</code> ループで、<code>i</code> をもう一度利用することができる。また、<code>if</code> や <code>while</code> 文における宣言のスコープも正しく実装されている。
      </p>
      <CODE_SNIPPET>
        while (const char* p = strchr(str, '/')) str = p + 1;
      </CODE_SNIPPET>
      <p>
<!--
        There is one caveat:  if the variable is an object, its
        constructor is invoked every time it enters scope and is
        created, and its destructor is invoked every time it goes
        out of scope.
-->
        1つ注意しておくべきことがある。変数がオブジェクトの場合、そのスコープに入るたびにコンストラクタが実行されてオブジェクトが生成される。そしてスコープから抜けるたびにデストラクタが実行されることになる。
      </p>
      <BAD_CODE_SNIPPET>
        // 効率のわるい実装
        for (int i = 0; i &lt; 1000000; ++i) {
          Foo f;  // コンストラクタとデストラクタはそれぞれ1000000回呼び出される。
          f.DoSomething(i);
        }
      </BAD_CODE_SNIPPET>
      <p>
<!--
        It may be more efficient to declare such a variable used in a
        loop outside that loop:
-->
        したがって、ループ内で使う変数は、ループの外側で宣言しておく方が効率がよいかもしれない。
      </p>
      <CODE_SNIPPET>
        Foo f;  // コンストラクタとデストラクタはそれぞれ1回だけ呼び出される。
        for (int i = 0; i &lt; 1000000; ++i) {
          f.DoSomething(i);
        }
      </CODE_SNIPPET>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Static and Global Variables">-->
  <STYLEPOINT title="スタティック変数とグローバル変数">
    <SUMMARY>
<!--
      Static or global variables of class type are forbidden: they cause
      hard-to-find bugs due to indeterminate order of construction and
      destruction.
-->
      クラス型のスタティック変数またはグローバル変数の使用を禁止する。これらは生成と解放の順序が不定であるため、見つけにくいバグを引き起こす。
    </SUMMARY>
    <BODY>
      <p>
<!--
        Objects with static storage duration, including global variables,
        static variables, static class member variables, and function static
        variables, must be Plain Old Data (POD): only ints, chars, floats, and
        void, and arrays of/structs of/pointers to POD. Static variables must
        not be initialized with the result of a function; and non-const static
        variables must not be used in threaded code.
-->
        グローバル変数やスタティック変数、スタティッククラスメンバ変数、関数スタティック変数を含む静的記憶域期間のあるオブジェクトは、POD（Plain Old Data）でなければならない。PODとは、int、char、float、voidと、これらの配列、構造体、ポインタだけだ。スタティック変数は関数の結果で初期化してはいけない。そして、非constスタティック変数はマルチスレッドのコードで使ってはいけない。
      </p>
      <p>
<!--
        The order in which class constructors, destructors, and initializers for
        static variables are called is only partially specified in C++ and can
        even change from build to build, which can cause bugs that are difficult
        to find. For example, at program-end time a static variable might have
        been destroyed, but code still running - perhaps in another thread -
        tries to access it and fails.
-->       
        C++では、コンストラクタ、デストラクタ、スタティック変数のイニシャライザが呼ばれる順序は部分的にしか決まっておらず、ビルドするたびに変わるおそれがある。このため、発見困難なバグを引き起こすおそれがある。例えば、プログラム終了時にスタティック変数は破壊されるかもしれないが、まだ動いているコードが（おそらく別のスレッドで）その変数にアクセスしようとして失敗するかもしれない。
      </p>
      <p>
<!--
        As a result we only allow static variables to contain POD data.  This
        rule completely disallows <code>vector</code> (use C arrays instead),
        <code>string</code> (use <code>const char*</code>), or anything that
        contains or points to any class instance in any way, from ever being a
        part of a static variable.  For similar reasons, we don't allow static
        variables to be initialized with the result of a function call.
-->
        結局のところ、スタティック変数はPODデータを含むときにだけ使ってもよい。このルールは <code>vector</code>、<code>string</code>、とにかく任意のクラスのインスタンスを含んだり指しているものは、スタティック変数の一部になることが許されない、ということだ。似たような理由で、スタティック変数が関数呼び出しの結果で初期化されることも許されない。
      </p>
      
      <p>
<!--
        If you need a static or global variable of a class type, consider
        initializing a pointer which you never free from your main() function
        or from pthread_once().
-->
        もしクラス型のスタティック変数やグローバル変数が必要であれば、main() 関数や pthread_once() 関数から決して free されることのないポインタを初期化することを検討しよう。
      </p>
      <p>
<!--
        Please note that <code>static</code> class member variables
        count as global variables, and should not be of class types!
-->
        <code>static</code> クラスメンバ変数はグローバル変数とみなされることに注意すること。したがってクラス型にしてはいけない。
      </p>
      
      
    </BODY>
  </STYLEPOINT>
</CATEGORY>

<!-- <CATEGORY title="Classes">-->
<CATEGORY title="クラス">
<!--
  Classes are the fundamental unit of code in C++. Naturally, we use
  them extensively. This section lists the main dos and don'ts you
  should follow when writing a class.
-->
  クラスはC++コードの基本単位だ。もちろん、私たちも至るところでクラスを使っている。このセクションでは、クラスを書くときにすべきことすべきでないことを列挙する。

<!--  <STYLEPOINT title="Doing Work in Constructors">-->
  <STYLEPOINT title="コンストラクタでやるべきこと">
    <SUMMARY>
<!--
      Do only trivial initialization in a constructor.  If at all
      possible, use an <code>Init()</code> method for non-trivial
      initialization.
-->
      コンストラクタでやることは簡単な初期化だけにする。もし簡単でなければ、できる限り <code>Init()</code> メソッドを使うこと。
    </SUMMARY>
    <BODY>
      <DEFINITION>
<!--
        It is possible to perform initialization in the body of the
        constructor.
-->
        コンストラクタ本体で初期化をすることができる。
      </DEFINITION>
      <PROS>
<!--
        Convenience in typing.  No need to worry about whether the
        class has been initialized or not.
-->
        入力に好都合。クラスが初期化されているかどうかを気にする必要がなくなる。
      </PROS>
      <CONS>
<!--
        The problems with doing work in constructors are:
-->
        コンストラクタで初期化をするのには、いくつか問題がある。
        <ul>
<!--
          <li> There is no easy way for constructors to signal errors,
               short of using exceptions (which are
               <a HREF="#Exceptions">forbidden</a>).
-->
          <li> 例外以外にコンストラクタがエラーになったことを知る簡単な方法がない（外を使うことは<a HREF="#Exceptions">禁止</a>されている）。
               </li>
<!--
          <li> If the work fails, we now have an object whose
               initialization code failed, so it may be an
               indeterminate state.
-->
          <li> もし処理に失敗すると、初期化が完了していないオブジェクトが得られてしまう。このオブジェクトは不定状態になるおそれがある。
               </li>
<!--
          <li> If the work calls virtual functions, these calls will
               not get dispatched to the subclass implementations.
               Future modification to your class can quietly introduce
               this problem even if your class is not currently
               subclassed, causing much confusion.
-->
          <li> もしコンストラクタで仮想関数を呼び出していると、この呼び出しはサブクラス実装に対してディスパッチされない。
               たとえ今のところはサブクラス化されていなくても、後になってサブクラス化したときにこの問題が入り込んでしまい、大きな問題になるおそれがある。
               </li>
<!--
          <li> If someone creates a global variable of this type
               (which is against the rules, but still), the
               constructor code will be called before
               <code>main()</code>, possibly breaking some implicit
               assumptions in the constructor code.  For instance,
               
               <a href="http://google-gflags.googlecode.com/">gflags</a>
               will not yet have been initialized.
               </li>
-->
          <li> 誰かがクラス型のグローバル変数を作ってしまうと（これはルールに反しているが、それでも作ってしまった場合）、コンストラクタのコードは <code>main()</code> 関数よりも前に呼び出されることになる。おそらくこれは、コンストラクタのコードにとっては想定外のことだろう。

               例えば <a href="http://google-gflags.googlecode.com/">gflags</a> はまだ初期化されていない。
               </li>
        </ul>
      </CONS>
      <DECISION>
<!--
        If your object requires non-trivial initialization, consider
        having an explicit <code>Init()</code> method and/or adding a
        member flag that indicates whether the object was successfully
        initialized.
-->
        オブジェクトの初期化が簡単なものでなければ、明示的な <code>Init()</code> メソッドを用意したり、オブジェクトの初期化が成功したかどうかを示すフラグをメンバに追加するなどを検討すること。
      </DECISION>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Default Constructors">-->
  <STYLEPOINT title="デフォルトコンストラクタ">
    <SUMMARY>
<!--
      You must define a default constructor if your class defines
      member variables and has no other constructors.  Otherwise the
      compiler will do it for you, badly.
-->
      クラスがメンバ変数を定義していて他にコンストラクタがないのであれば、デフォルトコンストラクタを定義しなければならない。さもないとコンパイラが出来のわるいコンストラクタを定義してしまうだろう。
    </SUMMARY>
    <BODY>
      <DEFINITION>
<!--
        The default constructor is called when we <code>new</code> a
        class object with no arguments.  It is always called when
        calling <code>new[]</code> (for arrays).
-->
        クラスオブジェクトを引数なしで <code>new</code> すると、デフォルトコンストラクタが呼び出される。 <code>new[]</code> したときにもデフォルトコンストラクタが呼び出される（配列の場合）。
      </DEFINITION>
      <PROS>
<!--
        Initializing structures by default, to hold "impossible"
        values, makes debugging much easier.
-->
        デフォルトで「不可能な」値を持つように構造を初期化しておくと、デバッグがずっと簡単になる。
      </PROS>
      <CONS>
<!--
        Extra work for you, the code writer.
-->
        コードを書く人にとって余計な仕事になる。
      </CONS>
      <DECISION>
        <p>
<!--
          If your class defines member variables has no other
          constructors you must define a default constructor (one that
          takes no arguments). It should preferably initialize the
          object in such a way that its internal state is consistent
          and valid.
-->
          もしクラスにメンバ変数を定義していて他にコンストラクタがないのであれば、デフォルトコンストラクタ（引数をとらないコンストラクタ）を定義しなければならない。そのようなオブジェクトはできるだけ、矛盾のない有効な内部状態になるように初期化するべきだ。
        </p>
        <p>
<!--
          The reason for this is that if you have no other
          constructors and do not define a default constructor, the
          compiler will generate one for you. This compiler
          generated constructor may not initialize your object
          sensibly.
-->
          こうする理由は、もし他にコンストラクタがなくてデフォルトコンストラクタを定義していなければ、コンパイラがコンストラクタを生成してしまうためだ。コンパイラが生成したコンストラクタは、オブジェクトをうまく初期化してくれないかもしれない。
        </p>
        <p>
<!--
          If your class inherits from an existing class but you add no
          new member variables, you are not required to have a default
          constructor.
-->          
          もしそのクラスが既存のクラスから継承したものであり、新しいメンバ変数を追加していないのであれば、デフォルトコンストラクタを持つ必要はない。
        </p>
      </DECISION>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Explicit Constructors">-->
  <STYLEPOINT title="明示的なコンストラクタ">
    <SUMMARY>
<!--
      Use the C++ keyword <code>explicit</code> for constructors with
      one argument.
-->
      引数が1つのコンストラクタには、C++の <code>explicit</code> キーワードを付ける。
    </SUMMARY>
    <BODY>
      <DEFINITION>
<!--
        Normally, if a constructor takes one argument, it can be used
        as a conversion.  For instance, if you define
        <code>Foo::Foo(string name)</code> and then pass a string to a
        function that expects a <code>Foo</code>, the constructor will
        be called to convert the string into a <code>Foo</code> and
        will pass the <code>Foo</code> to your function for you.  This
        can be convenient but is also a source of trouble when things
        get converted and new objects created without you meaning them
        to.  Declaring a constructor <code>explicit</code> prevents it
        from being invoked implicitly as a conversion.
-->
        通常、引数が1つのコンストラクタは変換に使われる。例えば <code>Foo::Foo(string name)</code> が定義してあり、<code>Foo</code> を期待している関数に文字列を渡すと、コンストラクタが呼び出されて文字列を <code>Foo</code> に変換する。そして関数にはその <code>Foo</code> が渡されることになる。これは便利だ。しかし、変換によって暗黙のうちに新しいオブジェクトが生成されるのは、トラブルの原因にもなる。コンストラクタに <code>explicit</code> を宣言しておくと、暗黙に変換されるのを防ぐことができる。
      </DEFINITION>
      <PROS>
<!--
        Avoids undesirable conversions.
-->
        望ましくない変換を避けることができる。
      </PROS>
      <CONS>
<!--
        None.
-->
        なし。
      </CONS>
      <DECISION>
        <p>
<!--
          We require all single argument constructors to be
          explicit. Always put <code>explicit</code> in front of
          one-argument constructors in the class definition:
          <code>explicit Foo(string name);</code>
-->
          私たちは1つの引数をとるコンストラクタにはすべて、explicit を付けることにする。クラス定義において、引数が1つのコンストラクタの前には必ず <code>explicit</code> を付けること。
          <code>explicit Foo(string name);</code>
        </p>
        <p>
<!--
          The exception is copy constructors, which, in the rare
          cases when we allow them, should probably not be
          <code>explicit</code>.
          
          Classes that are intended to be
          transparent wrappers around other classes are also
          exceptions.
          Such exceptions should be clearly marked with comments.
-->
          ただしコピーコンストラクタは例外だ。こういうケースはめったにないが、<code>explicit</code> を付けるべきではないだろう。

          他のクラスに対する透過的なラッパとして使うクラスもまた例外だ。
          こういう例外はコメントにはっきりと明記しておくべきだ。
        </p>
      </DECISION>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Copy Constructors">-->
  <STYLEPOINT title="コピーコンストラクタ">
    <SUMMARY>
<!--
      Use copy constructors only when your code needs to copy a class;
      most do not need to be copied and so should use
      <code>DISALLOW_COPY_AND_ASSIGN</code>.
-->
      コピーコンストラクタはクラスをコピーする必要があるときだけ使う。たいていのクラスはコピーする必要はないはずだ。そのときには <code>DISALLOW_COPY_AND_ASSIGN</code> を使うべきだ。
    </SUMMARY>
    <BODY>
      <DEFINITION>
<!--
        The copy constructor is used when copying one object into a
        new one (especially when passing objects by value).
-->
        コピーコンストラクタは、あるオブジェクトを新しいオブジェクトにコピーするときに使われる（特に、オブジェクトを値渡しするとき）。
      </DEFINITION>
      <PROS>
<!--
        Copy constructors make it easy to copy objects.  STL
        containers require that all contents be copyable and
        assignable.
-->
        コピーコンストラクタはオブジェクトのコピーを簡単にしてくれる。STLコンテナに格納するコンテンツはすべて、コピー可能であり代入可能である必要がある。
      </PROS>
      <CONS>
<!--
        Implicit copying of objects in C++ is a rich source of bugs
        and of performance problems. It also reduces readability, as
        it becomes hard to track which objects are being passed around
        by value as opposed to by reference, and therefore where
        changes to an object are reflected.
-->
        C++におけるオブジェクトの暗黙のコピーは、バグとパフォーマンス問題の温床になっている。またソースも読みにくくなる。どのオブジェクトが参照渡しではなく値渡しなのか、その結果、どこでオブジェクトに対する変更が反映されているのか、といった追跡がしにくくなるためだ。
      </CONS>
      <DECISION>
        <p>
<!--
          Most classes do not need to be copyable, and should not have a
          copy constructor or an assignment operator. Unfortunately, the
          compiler generates these for you, and makes them public, if
          you do not declare them yourself.
-->
          たいていのクラスはコピー可能である必要はなく、コピーコンストラクタや代入オペレータを持つべきではない。残念ながら自分でこれらを宣言しておかないと、コンパイラ自身が生成して、それをパブリックにしてしまう。
        </p>
        
        <p>
<!--
          Consider adding dummy declarations for the copy constructor and
          assignment operator in the class' <code>private:</code> section,
          without providing definitions. With these dummy routines marked
          private, a compilation error will be raised if other code
          attempts to use them.  For convenience, a
          <code>DISALLOW_COPY_AND_ASSIGN</code> macro can be used:
-->
          定義のないコピーコンストラクタと代入オペレータのダミー宣言を、クラスの <code>private:</code> セクションに追加することを検討しよう。ダミールーチンをプライベートにしておくと、他のコードが使おうとしたときにコンパイルエラーになる。便利な <code>DISALLOW_COPY_AND_ASSIGN</code> マクロを使うことができる。
        </p>
        <CODE_SNIPPET>
          // コピーコンストラクタと=オペレータ関数を無効にするマクロ
          // これはクラスの private: 宣言の中で使うべきだ。
          #define DISALLOW_COPY_AND_ASSIGN(TypeName) \
            TypeName(const TypeName&amp;);               \
            void operator=(const TypeName&amp;)
        </CODE_SNIPPET>
        <p>
<!--
          Then, in <code>class Foo</code>:
-->
          そして <code>class Foo</code> の中では次のようにする。
        </p>
        <CODE_SNIPPET>
          class Foo {
           public:
            Foo(int f);
            ~Foo();

           private:
            DISALLOW_COPY_AND_ASSIGN(Foo);
          };
        </CODE_SNIPPET>
        <p>
<!--
          In almost all cases your class should use the
          <code>DISALLOW_COPY_AND_ASSIGN</code>
          macro as described above.  If your class is one of the rare
          classes that does need to be copyable, you should document why
          this is so in the header file for that class, and you should
          define the copy constructor and assignment operator
          appropriately.  Remember to check for self-assignment in
          <code>operator=</code>.
-->
         ほとんどすべてのケースで、上に説明したような <code>DISALLOW_COPY_AND_ASSIGN</code> マクロを使うべきだ。コピー可能にする必要があるというクラスもまれにあるが、その場合はなぜそうする必要があるのかをクラスのヘッダファイルに明記しておくこと。それからコピーコンストラクタと代入オペレータを適切に定義するべきだ。<code>operator=</code> では、自己代入をチェックするのを忘れないこと。
        </p>
        <p>
<!--
          You may be tempted to make your class copyable so that you
          can use it as a value in STL containers. In almost all such
          cases you should really put <em>pointers</em> to your
          objects in the STL container.  You may also want to consider
          using
          
          <code>std::tr1::shared_ptr</code>.
-->
          クラスをコピー可能にしてSTLコンテナの値として使いたくなるかもしれない。実際にはほとんどの場合、STLコンテナにはオブジェクトを指す<em>ポインタ</em>を格納するべきだ。<code>std::tr1::shared_ptr</code> の利用を検討してもよい。
        </p>
        
      </DECISION>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Structs vs. Classes">-->
  <STYLEPOINT title="構造体 対 クラス">
    <SUMMARY>
<!--
      Use a <code>struct</code> only for passive objects that carry data;
      everything else is a <code>class</code>.
-->
      <code>struct</code> はデータを運ぶ受動的なオブジェクトだけに使う。それ以外はすべて <code>class</code> にする。
    </SUMMARY>
    <BODY>
      <p>
<!--
        The <code>struct</code> and <code>class</code> keywords behave
        almost identically in C++.  We add our own semantic meanings
        to each keyword, so you should use the appropriate keyword for
        the data-type you're defining.
-->
        C++では、<code>struct</code> と <code>class</code> というキーワードはほとんど同じ動作になる。そこで私たちはそれぞれのキーワードに意味を持たせることにした。定義するデータの種類に合わせて、それぞれのキーワードを使い分けるべきだ。
      </p>
      <p>
<!--
        <code>structs</code> should be used for passive objects that carry
        data, and may have associated constants, but lack any functionality
        other than access/setting the data members. The
        accessing/setting of fields is done by directly accessing the
        fields rather than through method invocations. Methods should
        not provide behavior but should only be used to set up the
        data members, e.g., constructor, destructor,
        <code>Initialize()</code>, <code>Reset()</code>,
        <code>Validate()</code>.
-->
        <code>struct</code> はデータを運ぶ受動的なオブジェクトに使うべきだ。定数と関連付けてもよいが、データメンバの取得/設定以外の機能を持たせてはいけない。フィールドの取得/設定は、メソッド呼び出しではなくフィールドに直接アクセスすることにより実行する。メソッドは動作を提供するべきではなく、データメンバの設定にのみ使われるべきだ。つまりコンストラクタ、デストラクタ、<code>Initialize()</code>、<code>Reset()</code>、<code>Validate()</code> などだけにすること。
      </p>
      <p>
<!--
        If more functionality is required, a <code>class</code> is more
        appropriate.  If in doubt, make it a <code>class</code>.
-->
        もっと機能が必要であれば <code>class</code> を使う方が適している。はっきりしなければ <code>class</code> にしておこう。
      </p>
      <p>
<!--
        For consistency with STL, you can use <code>struct</code>
        instead of <code>class</code> for functors and traits.
-->
        STLと一貫性を持たせるために、functor や traint には <code>class</code> ではなく <code>struct</code> を使っても構わない。
      </p>
      <p>
<!--
        Note that member variables in structs and classes have
        <a HREF="#Variable_Names">different naming rules</a>.
-->
        構造体とクラスのメンバ変数には<a HREF="#Variable_Names">異なる命名規則</a>があることに注意すること。
      </p>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Inheritance">-->
  <STYLEPOINT title="継承">
    <SUMMARY>
<!--
      Composition is often more appropriate than inheritance.  When
      using inheritance, make it <code>public</code>.
-->
      継承よりもコンポジションの方がふさわしい場合が多い。継承を使うときには、<code>public</code> 継承にする。
    </SUMMARY>
    <BODY>
      <DEFINITION>
<!--
        When a sub-class inherits from a base class, it includes the
        definitions of all the data and operations that the parent
        base class defines.  In practice, inheritance is used in two
        major ways in C++: implementation inheritance, in which
        actual code is inherited by the child, and <A HREF="#Interfaces">interface inheritance</A>, in which only
        method names are inherited.
-->
        ベースクラスからサブクラスを継承すると、親となるベースクラスに定義されているデータと操作の定義がすべてサブクラスにも含まれることになる。実際のところ、C++における継承の使い方には大きく二通りある。1つは実装の継承であり、実際のコードが子クラスによって継承される。そしてもう1つが<A HREF="#Interfaces">インタフェースの継承</A>であり、メソッド名だけが継承される。
      </DEFINITION>
      <PROS>
<!--
        Implementation inheritance reduces code size by re-using the
        base class code as it specializes an existing type.  Because
        inheritance is a compile-time declaration, you and the
        compiler can understand the operation and detect errors.
        Interface inheritance can be used to programmatically enforce
        that a class expose a particular API.  Again, the compiler
        can detect errors, in this case, when a class does not define
        a necessary method of the API.
-->
        実装の継承は既存の型を特殊化するものであり、ベースクラスのコードを再利用することでコードサイズを減らすことができる。継承はコンパイル時に宣言されるため、あなたもコンパイラも何が行われるか理解してエラーを見つけることができる。
        インタフェースの継承はクラスに特定のAPIを公開させるために使うことができる。この場合にもコンパイラはエラーを検出することができる。クラスに必要とされているAPIメソッドが定義されていなければエラーになる。
      </PROS>
      <CONS>
<!--
        For implementation inheritance, because the code implementing
        a sub-class is spread between the base and the sub-class, it
        can be more difficult to understand an implementation.  The
        sub-class cannot override functions that are not virtual, so
        the sub-class cannot change implementation.  The base class
        may also define some data members, so that specifies physical
        layout of the base class.
-->
       実装の継承の場合、サブクラスの実装コードがベースクラスとサブクラスにまたがってしまうため、理解しにくくなる。またサブクラスでは非仮想関数を上書きすることができないため、サブクラスがその実装を変更することはできない。ベースクラスにデータメンバを定義することもできるが、こうするとベースクラスの物理的レイアウトが決まってしまう。
      </CONS>
      <DECISION>
        <p>
<!--
          All inheritance should be <code>public</code>.  If you want to
          do private inheritance, you should be including an instance of
          the base class as a member instead.
-->
          継承はすべて <code>public</code> にするべきだ。もしプライベート継承を使いたければ、代わりにベースクラスのインスタンスをメンバとして持たせるべきだ。
        </p>
        <p>
<!--
          Do not overuse implementation inheritance.  Composition is
          often more appropriate. Try to restrict use of inheritance
          to the "is-a" case: <code>Bar</code> subclasses
          <code>Foo</code> if it can reasonably be said that
          <code>Bar</code> "is a kind of" <code>Foo</code>.
-->
          実装の継承を使いすぎてはいけない。実際のところコンポジションの方がふさわしい場合が多い。継承は "is-a" の関係があるときだけ使うようにしてみよう。
もし <code>Bar</code> は <code>Foo</code> の一種（a kind of）だと無理なく言えるのであれば、<code>Bar</code> は <code>Foo</code> のサブクラスにしてもよい。
        </p>
        <p>
<!--
          Limit the use of <code>protected</code> to those member
          functions that might need to be accessed from subclasses.
          Note that <a href="#Access_Control">data members must always
          be private</a>.
-->
          <code>protected</code> を使うのは、サブクラスからアクセスされる必要があるかもしれないメンバ関数だけに制限しよう。<a href="#Access_Control">データメンバは常にプライベートでなければならない</a>ことに注意しよう。
        </p>
        <p>
<!--
          When redefining an inherited virtual function, explicitly
          declare it <code>virtual</code> in the declaration of the
          derived class.  Rationale: If <code>virtual</code> is
          omitted, the reader has to check all ancestors of the
          class in question to determine if the function is virtual
         or not.
-->
          継承した仮想関数を再定義するときには、派生したクラスの宣言で <code>virtual</code> だと明示的に宣言すること。<code>virtual</code> を省略してしまうと、コードを読む人はその関数が仮想関数かどうかを確認するために、そのクラスのすべての先祖をチェックしなければいけなくなるためだ。
        </p>
      </DECISION>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Multiple Inheritance">-->
  <STYLEPOINT title="多重継承">
    <SUMMARY>
<!--
      Only very rarely is multiple implementation inheritance actually
      useful.  We allow multiple inheritance only when at most one of
      the base classes has an implementation; all other base classes
      must be <A HREF="#Interfaces">pure interface</A> classes tagged
      with the <code>Interface</code> suffix.
-->
      実際に実装の多重継承が役に立つことはまずない。ベースクラスのうち実装を持つクラスが高々1つであり、それ以外のクラスはすべて <code>Interface</code> というサフィックスのついた<A HREF="#Interfaces">純粋なインタフェース</A>クラスであるときのみ、多重継承を使っても構わない。
    </SUMMARY>
    <BODY>
      <DEFINITION>
<!--
        Multiple inheritance allows a sub-class to have more than one
        base class.  We distinguish between base classes that are
        <em>pure interfaces</em> and those that have an
        <em>implementation</em>.
-->
        多重継承を使うとサブクラスは1つ以上のベースクラスを持つことができる。私たちは<em>純粋なインタフェース</em>としてのベースクラスと<em>実装</em>を持つベースクラスを区別している。
      </DEFINITION>
      <PROS>
<!--
        Multiple implementation inheritance may let you re-use even more code
        than single inheritance (see <a HREF="#Inheritance">Inheritance</a>).
-->
        実装の多重継承は単一継承よりもさらにコードの再利用ができることがある。（<a HREF="#Inheritance">継承</a>を参照すること）。
      </PROS>
      <CONS>
<!--
        Only very rarely is multiple <em>implementation</em>
        inheritance actually useful. When multiple implementation
        inheritance seems like the solution, you can usually find a
        different, more explicit, and cleaner solution.
-->
        実際のところ、<em>実装</em>の多重継承が役に立つことはまずない。実装の多重継承が解決策になると思ったときには通常、別のもっと明確なきれいな解決策を見つけることができるはずだ。
      </CONS>
      <DECISION>
<!--
        Multiple inheritance is allowed only when all superclasses, with the
        possible exception of the first one, are <A HREF="#Interfaces">pure
        interfaces</A>.  In order to ensure that they remain pure interfaces,
        they must end with the <code>Interface</code> suffix.
-->
        最初の1つを除くすべてのスーパークラスが<A HREF="#Interfaces">純粋なインタフェース</A>であるときのみ、多重継承を使うことを許す。純粋なインタフェースであることを保証するために、これらは <code>Interface</code> というサフィックスで終わらなければならない。
<!--        <SUBSECTION title="Note:">-->
        <SUBSECTION title="注意:">
<!--
          There is an <a HREF="#Windows_Code">exception</a> to this
          rule on Windows.
-->
          Windows の場合には<a HREF="#Windows_Code">例外</a>がある。
        </SUBSECTION>
      </DECISION>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Interfaces">-->
  <STYLEPOINT title="インタフェース">
    <SUMMARY>
<!--
      Classes that satisfy certain conditions are allowed, but not required, to
      end with an <code>Interface</code> suffix.
-->
      ある条件を満たしているクラスには、<code>Interface</code> というサフィックスを付けてもよい。これは必須ではない。
    </SUMMARY>
    <BODY>
      <DEFINITION>
        <p>
<!--
        A class is a pure interface if it meets the following requirements:
-->
        クラスが次の条件に当てはまるのであれば、それは純粋なインタフェースだ。
        </p>
        <ul>
<!--
          <li> It has only public pure virtual ("<code>= 0</code>") methods
               and static methods (but see below for destructor).
-->
          <li> パブリックな純粋仮想（"<code>= 0</code>"）メソッドとスタティックメソッドしかない（ただし、デストラクタについては以下を参照すること）。
               </li>
<!--
          <li> It may not have non-static data members.
-->
          <li> 非スタティックデータメンバはなくてもよい。
               </li>
<!--
          <li> It need not have any constructors defined.  If a constructor is
               provided, it must take no arguments and it must be protected.
-->
          <li> コンストラクタを定義する必要がない。もしコンストラクタがあるなら、それには引数がなくて protected でなければならない。
               </li>
<!--
          <li> If it is a subclass, it may only be derived from classes
               that satisfy these conditions and are tagged with the
               <code>Interface</code> suffix.
-->
          <li> もしサブクラスであれば、これらの条件を満たすクラスから継承されており、そのクラス名には <code>Interface</code> サフィックスが付いている。
               </li>
        </ul>
        <p>
<!--
          An interface class can never be directly instantiated
          because of the pure virtual method(s) it declares.  To make
          sure all implementations of the interface can be destroyed
          correctly, they must also declare a virtual destructor (in
          an exception to the first rule, this should not be pure).  See
          Stroustrup, <cite>The C++ Programming Language</cite>, 3rd
          edition, section 12.4 for details.
-->
          インタフェースクラスには純粋仮想メソッドが宣言されているため、直接インスタンス化することはできない。インタフェースの実装をすべて正しく確実に破棄するには、仮想デストラクタも宣言しておく必要がある（最初のルールの例外として、これは純粋仮想メソッドにすべきではない）。詳しくは、Stroustrup の <cite>The C++ Programming Language</cite> 第3版のセクション 12.4 を参照すること。
        </p>
      </DEFINITION>
      <PROS>
<!--
        Tagging a class with the <code>Interface</code> suffix lets
        others know that they must not add implemented methods or non
        static data members.  This is particularly important in the case of
        <A HREF="#Multiple_Inheritance">multiple inheritance</A>.
        Additionally, the interface concept is already well-understood by
        Java programmers.
-->
        クラス名に <code>Interface</code> というサフィックスを付けておくと、実装を伴うメソッドや非スタティックデータメンバを追加してはいけないことが他人にもわかる。これは<A HREF="#Multiple_Inheritance">多重継承</A>の場合には特に重要だ。
        これに加えて、インタフェースというコンセプトはすでにJavaプログラマによく理解されている。
      </PROS>
      <CONS>
<!--
        The <code>Interface</code> suffix lengthens the class name, which
        can make it harder to read and understand.  Also, the interface
        property may be considered an implementation detail that shouldn't
        be exposed to clients.
-->
        <code>Interface</code> というサフィックスを付けるとクラス名が長くなってしまい、読みにくくて理解しにくくなるおそれがある。また、インタフェースという属性はクライアントに公開するべきではない実装詳細のように思えてしまうかもしれない。
      </CONS>
      <DECISION>
<!--
        A class may end with <code>Interface</code> only if it meets the
        above requirements.  We do not require the converse, however:
        classes that meet the above requirements are not required to end
        with <code>Interface</code>.
-->
        上の条件を満たすときのみ、クラスは <code>Interface</code> で終わってもよい。しかしその逆は要求しない。上の条件を満たすクラスは <code>Interface</code> で終わる必要はない。
      </DECISION>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Operator Overloading">-->
  <STYLEPOINT title="オペレータのオーバーロード">
    <SUMMARY>
<!--
      Do not overload operators except in rare, special circumstances.
-->
      まれな特殊な状況を除いて、オペレータをオーバーロードしてはいけない。
    </SUMMARY>
    <BODY>
      <DEFINITION>
<!--
        A class can define that operators such as <code>+</code> and
        <code>/</code> operate on the class as if it were a built-in
        type.
-->
        組み込み型のようにクラスを操作する <code>+</code> や <code>/</code> といったオペレータをクラスに定義することができる。
      </DEFINITION>
      <PROS>
<!--
        Can make code appear more intuitive because a class will
        behave in the same way as built-in types (such as
        <code>int</code>).  Overloaded operators are more playful
        names for functions that are less-colorfully named, such as
        <code>Equals()</code> or <code>Add()</code>.  For some
        template functions to work correctly, you may need to define
        operators.
-->
        クラスが（<code>int</code> などの）組み込み型と同じように使えるので、コードは直感的にわかりやすくなる。オペレータのオーバーロードというのは、<code>Equals()</code> や <code>Add()</code> といった面白味のない関数に対して、遊び心のある名前を付けることだ。正しく動かすためにオペレータを定義しなければならないテンプレート関数もある。
      </PROS>
      <CONS>
<!--
        While operator overloading can make code more intuitive, it
        has several drawbacks:
-->
        オペレータをオーバーロードするとコードは直感的にわかりやすくなるが、欠点もいくつかある。
        <ul>
<!--
          <li> It can fool our intuition into thinking that expensive
               operations are cheap, built-in operations.
-->
          <li> コストの高い操作なのに、コストの安い組み込み操作だと思わせてしまう。
               </li>
<!--
          <li> It is much harder to find the call sites for overloaded
               operators.  Searching for <code>Equals()</code> is much
               easier than searching for relevant invocations of
               <code>==</code>.
-->
          <li> オーバーロードしたオペレータを呼び出している場所を見つけるのは、とても難しくなる。<code>==</code> の呼び出しを探すよりも <code>Equals()</code> を探す方がはるかに簡単だ。
               </li>
<!--
          <li> Some operators work on pointers too, making it easy to
               introduce bugs.  <code>Foo + 4</code> may do one thing,
               while <code>&amp;Foo + 4</code> does something totally
               different. The compiler does not complain for either of
               these, making this very hard to debug.
-->
          <li> ポインタに対しても機能するオペレータもあるが、これはバグになりやすい。<code>Foo + 4</code> がやることと、<code>&amp;Foo + 4</code> がやることは全く違う。コンパイラはどちらにも警告を出さないので、デバッグは非常に難しくなる。
               </li>
        </ul>
<!--
        Overloading also has surprising ramifications.  For instance,
        you can't forward declare classes that overload
        <code>operator&amp;</code>.
-->
        オーバーロードには想定外の悪影響もある。例えば、<code>operator&amp;</code> をオーバーロードしているクラスは前方宣言することができない。
      </CONS>
      <DECISION>
        <p>
<!--
          In general, do not overload operators. The assignment operator
          (<code>operator=</code>), in particular, is insidious and
          should be avoided.  You can define functions like
          <code>Equals()</code> and <code>CopyFrom()</code> if you need
          them.
-->
          一般的に、オペレータのオーバーロードを使ってはいけない。特に、代入オペレータ（<code>operator=</code>）はたちが悪いので避けるべきだ。オペレータのオーバーロードが必要であれば <code>Equals()</code> や <code>CopyFrom()</code> のような関数を定義すればよい。
        </p>
        <p>
<!--
          However, there may be rare cases where you need to overload
          an operator to interoperate with templates or "standard" C++
          classes (such as <code>operator&lt;&lt;(ostream&amp;, const
          T&amp;)</code> for logging).  These are acceptable if fully
          justified, but you should try to avoid these whenever
          possible.  In particular, do not overload <code>operator==</code>
          or <code>operator&lt;</code> just so that your class can be
          used as a key in an STL container; instead, you should
          create equality and comparison functor types when declaring
          the container.
-->
          しかし、オペレータのオーバーロードが必要になるケースもまれにある。それはテンプレートや "標準" C++クラス（ログのための <code>operator&lt;&lt;(ostream&amp;, const T&amp;)</code> など）と一緒に使うときだ。十分妥当な理由がある場合にはオペレータのオーバーロードを使ってもよいが、できるだけ避けるべきだ。具体的には、STLコンテナのキーとして使えるからといって <code>operator==</code> や <code>operator&lt;</code> をオーバーロードしてはいけない。代わりに、コンテナを宣言するときには等価と比較の functor 型を作るべきだ。
        </p>
        <p>
<!--
          Some of the STL algorithms do require you to overload
          <code>operator==</code>, and you may do so in these cases,
          provided you document why.
-->
          STLアルゴリズムには <code>operator==</code> のオーバーロードが必要なものもある。その場合にはオーバーロードをしてもよいが、その理由を明記しておくこと。
        </p>
        <p>
<!--
          See also <a HREF="#Copy_Constructors">Copy Constructors</a>
          and <a HREF="#Function_Overloading">Function
          Overloading</a>.
-->
          <a HREF="#Copy_Constructors">コピーコンストラクタ</a>と<a HREF="#Function_Overloading">関数のオーバーロード</a>も参照すること。
        </p>
      </DECISION>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Access Control">-->
  <STYLEPOINT title="アクセス制御">
    <SUMMARY>
<!--
      Make <em>all</em> data members <code>private</code>, and provide
      access to them through accessor functions as needed.  Typically
      a variable would be called <code>foo_</code> and the accessor
      function <code>foo()</code>.  You may also want a mutator
      function <code>set_foo()</code>.
-->
      データメンバは<em>すべて</em> <code>private</code> にして、必要に応じてアクセサ関数でアクセスできるようにする。通常は変数を <code>foo_</code> に、アクセサ関数を <code>foo()</code> という形式にする。ミューテータ関数は <code>set_foo()</code> という形式にしてもよい。
    </SUMMARY>
    <BODY>
      <p>
<!--
        The definitions of accessors are usually inlined in the header
        file.
-->
        アクセサの定義は通常、ヘッダファイルにインライン化しておく。
      </p>
      <p>
<!--
        See also <a HREF="#Inheritance">Inheritance</a> and <a HREF="#Function_Names">Function Names</a>.
-->
        <a HREF="#Inheritance">継承</a>と<a HREF="#Function_Names">関数名</a>を参照すること。
      </p>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Declaration Order">-->
  <STYLEPOINT title="宣言の順序">
    <SUMMARY>
<!--
      Use the specified order of declarations within a class:
      <code>public:</code> before <code>private:</code>, methods
      before data members (variables), etc.
-->
      クラスにおける宣言は、次に指定した順序にする。<code>public:</code> は <code>private:</code> の前に置く、メソッドはデータメンバ（変数）の前に置くなど。
    </SUMMARY>
    <BODY>
      <p>
<!--
        Your class definition should start with its <code>public:</code>
        section, followed by its <code>protected:</code> section and
        then its <code>private:</code> section. If any of these sections
        are empty, omit them.
-->
        クラスの定義は <code>public:</code> セクションから始めて、<code>protected:</code> セクション、<code>private:</code> セクションという順にするべきだ。セクションが空であれば省略する。
      </p>
      <p>
<!--
        Within each section, the declarations generally should be in
        the following order:
-->
        各セクション内では通常、次の順序で宣言するべきだ。
      </p>
      <ul>
<!--
        <li> Typedefs and Enums</li>
        <li> Constants</li>
        <li> Constructors</li>
        <li> Destructor</li>
        <li> Methods, including static methods</li>
        <li> Data Members, including static data members</li>
-->
        <li> typedef と enum</li>
        <li> 定数</li>
        <li> コンストラクタ</li>
        <li> デストラクタ</li>
        <li> メソッド。スタティックメソッドも含む</li>
        <li> データメンバ。スタティックデータメンバも含む</li>
      </ul>
      <p>
<!--
        The <code>DISALLOW_COPY_AND_ASSIGN</code> macro invocation
        should be at the end of the <code>private:</code> section. It
        should be the last thing in the class. See <a HREF="#Copy_Constructors">Copy Constructors</a>.
-->
        <code>DISALLOW_COPY_AND_ASSIGN</code> マクロは <code>private:</code> セクションの最後に入れるべきだ。つまりこれがクラス定義の最後になる。<a HREF="#Copy_Constructors">コピーコンストラクタ</a>を参照すること。

      </p>
      <p>
<!--
        Method definitions in the corresponding <code>.cc</code> file
        should be the same as the declaration order, as much as possible.
-->
        <code>.cc</code> ファイルにおけるメソッドの定義は、できるだけ宣言の順序と同じにするべきだ。
      </p>
      <p>
<!--
        Do not put large method definitions inline in the class
        definition.  Usually, only trivial or performance-critical,
        and very short, methods may be defined inline.  See <a HREF="#Inline_Functions">Inline Functions</a> for more
        details.
-->
        大きなメソッドの定義をインライン化してクラスの定義に入れてはいけない。インラインで定義してもよいのは、簡単もしくはパフォーマンスに影響を及ぼす、非常に簡潔なメソッドだけだ。詳しくは<a HREF="#Inline_Functions">インライン関数</a>を参照すること。
      </p>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Write Short Functions">-->
  <STYLEPOINT title="簡潔な関数を書く">
    <SUMMARY>
<!--
      Prefer small and focused functions.
-->
      関数は小さく、ポイントを絞るのが望ましい。
    </SUMMARY>
    <BODY>
      <p>
<!--
        We recognize that long functions are sometimes appropriate, so
        no hard limit is placed on functions length. If a function
        exceeds about 40 lines, think about whether it can be broken
        up without harming the structure of the program.
-->
        私たちは長い関数の方がふさわしい場合があることを知っている。そのため、関数の長さには厳しい制限を設けていない。もし関数が約40行を超えるのであれば、プログラムの構造を変えずに関数を分割できないか考えること。
      </p>
      <p>
<!--
        Even if your long function works perfectly now, someone
        modifying it in a few months may add new behavior. This could
        result in bugs that are hard to find.  Keeping your functions
        short and simple makes it easier for other people to read and
        modify your code.
-->
       たとえ長い関数が完璧に動いていても、数か月後には誰かが変更して新しい動作を追加するかもしれない。これは見つけにくいバグを生むおそれがある。関数を短くシンプルにしておくと、他人が読みやすく変更しやすいコードになる。
      </p>
      <p>
<!--
        You could find long and complicated functions when working
        with
        
        some
        code.  Do not be intimidated by modifying existing
        code: if working with such a function proves to be difficult,
        you find that errors are hard to debug, or you want to use a
        piece of it in several different contexts, consider breaking
        up the function into smaller and more manageable pieces.
-->
        コードをながめていると、長くて複雑な関数を見つけることがある。既存のコードを変更することを恐れてはいけない。もし扱いにくいと思ったり、エラーをデバックしにくいと思ったり、一部を別のところで使いたいと思ったら、その関数をもっと小さく分割して、管理できるようにしよう。
      </p>
    </BODY>
  </STYLEPOINT>
</CATEGORY>

<!--<CATEGORY title="Google-Specific Magic">-->
<CATEGORY title="Google特有のMagic">
  
  <p>
<!--
    There are various tricks and utilities that we use to make C++
    code more robust, and various ways we use C++ that may differ from
    what you see elsewhere.
-->
    C++のコードをもっと堅牢にするために、私たちはいろいろな技や道具を使っている。ここでのやり方は、あなたが他のところで目にしてきたコードとは違っているかもしれない。
  </p>

  
<!--  <STYLEPOINT title="Smart Pointers">-->
  <STYLEPOINT title="スマートポインタ">
    
    <SUMMARY>
<!--
      If you actually need pointer semantics, <code>scoped_ptr</code>
      is great.  You should only use <code>std::tr1::shared_ptr</code>
      under very specific conditions, such as when objects need to be
      held by STL containers.  You should never use <code>auto_ptr</code>.
-->
      実際にポインタが必要になったときには <code>scoped_ptr</code> を使うのが望ましい。STLコンテナによってオブジェクトを保持する必要がある、といった特別な場合にだけ <code>std::tr1::shared_ptr</code> を使うべきだ。 <code>auto_ptr</code> は使うべきではない。
    </SUMMARY>
    <BODY>
      <p>
<!--
        "Smart" pointers are objects that act like pointers but have
        added semantics.  When a <code>scoped_ptr</code> is
        destroyed, for instance, it deletes the object it's pointing
        to.  <code>shared_ptr</code> is the same way, but implements
        reference-counting so only the last pointer to an object
        deletes it.
-->
        「スマート」ポインタはポインタのように機能するが、追加の意味がある。例えば <code>scoped_ptr</code> が破壊されるときには、ポインタが指しているオブジェクトも delete される。<code>shared_ptr</code> も同様だがリファレンスカウンタを実装しており、オブジェクトを指している最後のポインタだけがそのオブジェクトを delete する。
      </p>
      <p>
<!--
        Generally speaking, we prefer that we design code with clear
        object ownership.  The clearest object ownership is obtained by
        using an object directly as a field or local variable, without
        using pointers at all.  On the other extreme, by their very definition,
        reference counted pointers are owned by nobody.  The problem with
        this design is that it is easy to create circular references or other
        strange conditions that cause an object to never be deleted.
        It is also slow to perform atomic operations every time a value is
        copied or assigned.
-->
        一般的には、明確なオーナーシップのあるコードを設計する方がよい。最も明確なオブジェクトのオーナーシップとは、ポインタを全く使わずにフィールドやローカル変数として直接オブジェクトを使うことだ。その対極にあるのがリファレンスカウントされたポインタであり、その定義からわかるように誰にも所有されていない。この場合の設計上の問題は、循環した参照やおかしな状況を作り出しやすく、決して delete されないオブジェクトができてしまうということだ。
        また、値をコピーしたり割り当てるときには必ずアトミックな操作を実行するため、遅いという問題もある。
      </p>
      <p>
<!--
        Although they are not recommended, reference counted pointers are
        sometimes the simplest and most elegant way to solve a problem.
-->
        推奨するわけではないが、リファレンスカウントされたポインタが問題を解決するのに最もシンプルでエレガントな方法になる場合もある。
      </p>
    </BODY>
  </STYLEPOINT>
  
  <STYLEPOINT title="cpplint">
    <SUMMARY>
<!--
      Use
      <code>cpplint.py</code>
      to detect style errors.
-->
      <code>cpplint.py</code> を使って、スタイルエラーを検出する。
    </SUMMARY>
    <BODY>
      <p>
<!--
        <code>cpplint.py</code>
        is a tool that reads a source file and
        identifies many style errors.  It is not perfect, and has both false
        positives and false negatives, but it is still a valuable tool.  False
        positives can be ignored by putting <code>// NOLINT</code> at
        the end of the line.
-->
        <code>cpplint.py</code> は、ソースファイルを読み込んで、たくさんのスタイルエラーを検出してくれるツールだ。このツールは完全ではなく、誤検出も検出漏れもあるのだが、それでも役に立つ。誤検出があった場合には、その行の末尾に <code>// NOLINT</code> を入れると無視することができる。
      </p>

      <p>
<!--
        Some projects have instructions on how to run <code>cpplint.py</code>
        from their project tools. If the project you are contributing to does
        not, you can download <A HREF="http://google-styleguide.googlecode.com/svn/trunk/cpplint/cpplint.py"><code>cpplint.py</code></A> separately.
-->
        プロジェクトで使っているツールからどのようにして <code>cpplint.py</code> を実行するのか、きちんと説明のあるプロジェクトもある。もしあなたが参加しているプロジェクトにそういう説明がなくても、個別に <A HREF="http://google-styleguide.googlecode.com/svn/trunk/cpplint/cpplint.py"><code>cpplint.py</code></A> をダウンロードして使用することができる。
      </p>
    </BODY>
  </STYLEPOINT>

  
</CATEGORY>

<!-- <CATEGORY title="Other C++ Features">-->
<CATEGORY title="その他のC++機能">
<!--  <STYLEPOINT title="Reference Arguments">-->
  <STYLEPOINT title="リファレンス引数">
    <SUMMARY>
<!--
      All parameters passed by reference must be labeled
      <code>const</code>.
-->
      参照渡しのパラメータにはすべて、<code>const</code> を付けなければならない。
    </SUMMARY>
    <BODY>
      <DEFINITION>
<!--
        In C, if a function needs to modify a variable, the
        parameter must use a pointer, eg <code>int foo(int
        *pval)</code>.  In C++, the function can alternatively
        declare a reference parameter: <code>int foo(int
        &amp;val)</code>.
-->
        Cでは、関数が変数を変更する必要がある場合、パラメータにポインタを使わなければならない。例えば <code>int foo(int *pval)</code>。C++では、別の方法として、リファレンスパラメータを宣言することができる。<code>int foo(int &amp;val)</code>
      </DEFINITION>
      <PROS>
<!--
        Defining a parameter as reference avoids ugly code like
        <code>(*pval)++</code>.  Necessary for some applications like
        copy constructors.  Makes it clear, unlike with pointers, that
        <code>NULL</code> is not a possible value.
-->
        パラメータをリファレンスとして定義すると、<code>(*pval)++</code> といった見苦しいコードを避けることができる。コピーコンストラクタのような応用にも必要になる。ポインタと違って、リファンレンスは <code>NULL</code> が可能な値ではないことを明確にしてくれる。
      </PROS>
      <CONS>
<!--
        References can be confusing, as they have value syntax but
        pointer semantics.
-->
        リファレンスはまぎらわしい。構文は値と同じだが、意味はポインタと同じになる。
      </CONS>
      <DECISION>
        <p>
<!--
          Within function parameter lists all references must be
          <code>const</code>:
-->
          関数パラメータのリストでは、すべてのリファレンスに <code>const</code> を付けなければならない。
        </p>
        <CODE_SNIPPET>
          void Foo(const string &amp;in, string *out);
        </CODE_SNIPPET>
        <p>
<!--
          In fact it is a very strong convention in Google code that input
          arguments are values or <code>const</code> references while
          output arguments are pointers.  Input parameters may be
          <code>const</code> pointers, but we never allow
          non-<code>const</code> reference parameters.
-->
          実際のところ、入力引数は値か <code>const</code> リファレンスであり、出力引数はポインタであるというのは、Google code における非常に厳しい規約だ。入力パラメータに <code>const</code> ポインタを使っても構わないが、非<code>const</code> のリファレンスを使うことは許されない。
        </p>
        <p>
<!--
          One case when you might want an input parameter to be a
          <code>const</code> pointer is if you want to emphasize that the
          argument is not copied, so it must exist for the lifetime of the
          object; it is usually best to document this in comments as
          well.  STL adapters such as <code>bind2nd</code> and
          <code>mem_fun</code> do not permit reference parameters, so
          you must declare functions with pointer parameters in these
          cases, too.
-->
          入力パラメータを <code>const</code> ポインタにしたくなるケースがある。引数がコピーされておらず、そのオブジェクトの生存期間に存在しなければならないことを強調したい場合だ。これは通常、コメントに明記しておくのが最適だ。<code>bind2nd</code> と <code>mem_fun</code> のようなSTLアダプタはリファレンスパラメータを許していない。そのため、この場合には、ポインタをパラメータとする関数も宣言しなければならない。
        </p>
      </DECISION>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Function Overloading">-->
  <STYLEPOINT title="関数のオーバーロード">
    <SUMMARY>
<!--
      Use overloaded functions (including constructors) only in cases
      where input can be specified in different types that contain the
      same information.  Do not use function overloading to simulate
      <A HREF="#Default_Arguments">default function parameters</A>.
-->
      関数のオーバーロードを使うのは、同じ入力情報が異なる型で指定されている場合だけにする。<A HREF="#Default_Arguments">デフォルト関数パラメータ</A>をシミュレートするために関数のオーバーロードを使ってはいけない。
    </SUMMARY>
    <BODY>
      <DEFINITION>
        <p>
<!--
          You may write a function that takes a
          <code>const string&amp;</code> and overload it with another that
          takes <code>const char*</code>.
-->
          <code>const string&amp;</code> を引数とする関数を書き、それを<code>const char*</code>を引数とする別の関数でオーバーロードしても構わない。
        </p>
        <CODE_SNIPPET>
          class MyClass {
           public:
            void Analyze(const string &amp;text);
            void Analyze(const char *text, size_t textlen);
          };
        </CODE_SNIPPET>
      </DEFINITION>
      <PROS>
<!--
        Overloading can make code more intuitive by allowing an
        identically-named function to take different arguments.  It
        may be necessary for templatized code, and it can be
        convenient for Visitors.
-->
        オーバーロードを使うと引数が異なる関数に同じ名前を付けることができ、コードを直感的にわかりやすくする。これはテンプレート化されたコードに必要となることがある。また、Visitor を使うときにも便利だ。
      </PROS>
      <CONS>
<!--
        One reason to minimize function overloading is that
        overloading can make it hard to tell which function is being
        called at a particular call site.  Another one is that most
        people are confused by the semantics of inheritance if a
        deriving class overrides only some of the variants of a
        function.  Moreover, reading client code of a library may
        become unnecessarily hard because of all the reasons against
        <A HREF="#Default_Arguments">default function parameters</A>.
-->
        関数のオーバーロードの使用を最小限にする理由の1つは、ある呼び出しがどの関数を呼び出しているのか理解しにくくなることだ。もう1つの理由は、もし継承しているクラスが関数をいくつかだけ上書きしているとき、たいていの人が継承の意味に混乱してしまうことだ。さらにライブラリのクライアントコードを読むのは、必要以上に難しくなる。これは<A HREF="#Default_Arguments">デフォルト関数パラメータ</A>の使用に反対するのと同じ理由だ。
      </CONS>
      <DECISION>
<!--
        If you want to overload a function, consider qualifying the
        name with some information about the arguments, e.g.,
        <code>AppendString()</code>, <code>AppendInt()</code> rather
        than just <code>Append()</code>.
-->
        関数のオーバーロードをしたいのであれば、引数にちなんだ意味のある関数名にすることを検討すること。例えば、単なる <code>Append()</code> ではなく、<code>AppendString()</code> や <code>AppendInt()</code> とする。
      </DECISION>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Default Arguments">-->
  <STYLEPOINT title="デフォルト引数">
    <SUMMARY>
<!--
      We do not allow default function parameters.
-->
      デフォルト関数パラメータを使ってはいけない。
    </SUMMARY>
    <BODY>
      <PROS>
<!--
        Often you have a function that uses lots of default values,
        but occasionally you want to override the defaults.  Default
        parameters allow an easy way to do this without having to
        define many functions for the rare exceptions.
-->
        デフォルト値がたくさんある関数をよく見かけるが、デフォルトを上書きしたいときもある。デフォルトパラメータを使うと、めったにない例外のために関数をたくさん定義する必要がなくり、簡単になる。
      </PROS>
      <CONS>
<!--
        People often figure out how to use an
        API by looking at existing code that uses it.
        Default parameters are more difficult to maintain because
        copy-and-paste from previous code may not reveal all the
        parameters.  Copy-and-pasting of code segments can cause major
        problems when the default arguments are not appropriate for
        the new code.
-->
        APIを使っている既存のコードを見ることで、そのAPIの使い方が理解できることがよくある。
        デフォルトパラメータは管理するのが難しい。以前のコードからコピー・アンド・ペーストしても、すべてのパラメータが見えているわけではないためだ。コードの断片をコピー・アンド・ペーストすると、デフォルト引数が新しいコードにとってふさわしくないときに大きな問題となる。
      </CONS>
      <DECISION>
<!--
        We require all arguments to be explicitly specified, to
        force programmers to consider the API and the values they are
        passing for each argument rather than silently accepting
        defaults they may not be aware of.
-->
        プログラマはよく理解せずにデフォルトを黙って受け入れてはいけない。APIと引数として渡している値についてよく検討させるため、すべての引数を明示的に指定すること。
      </DECISION>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Variable-Length Arrays and alloca()">-->
  <STYLEPOINT title="可変長配列と alloca()">
    <SUMMARY>
<!--
      We do not allow variable-length arrays or <code>alloca()</code>.
-->
      可変長配列や <code>alloca()</code> を使ってはいけない。
    </SUMMARY>
    <BODY>
      <PROS>
<!--
        Variable-length arrays have natural-looking syntax.  Both
        variable-length arrays and <code>alloca()</code> are very
        efficient.
-->
        可変長配列は自然な構文だ。可変長配列と <code>alloca()</code> はどちらも非常に効率がよい。
      </PROS>
      <CONS>
<!--
        Variable-length arrays and alloca are not part of Standard
        C++.  More importantly, they allocate a data-dependent amount
        of stack space that can trigger difficult-to-find memory
        overwriting bugs: "It ran fine on my machine, but dies
        mysteriously in production".
-->
        可変長配列と alloca は標準のC++の一部ではない。もっと問題なのは、スタック空間にデータ依存したメモリを割り当てて、発見困難なメモリの重ね書きバグを引き起こすおそれがあることだ。「ぼくのマシンだとうまく動くのに、現場だとなぜか落ちてしまう」。
      </CONS>
      
      <DECISION>
<!--
        Use a safe allocator instead, such as
        <code>scoped_ptr</code>/<code>scoped_array</code>.
-->
        <code>scoped_ptr</code>/<code>scoped_array</code> といった安全なアロケータを使うこと。
      </DECISION>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Friends">-->
  <STYLEPOINT title="フレンド">
    <SUMMARY>
<!--
      We allow use of <code>friend</code> classes and functions,
      within reason.
-->
      妥当な範囲であれば、<code>friend</code> クラスや <code>friend</code> 関数を使ってもよい。
    </SUMMARY>
    <BODY>
      <p>
<!--
        Friends should usually be defined in the same file so that the
        reader does not have to look in another file to find uses of
        the private members of a class.  A common use of
        <code>friend</code> is to have a <code>FooBuilder</code> class
        be a friend of <code>Foo</code> so that it can construct the
        inner state of <code>Foo</code> correctly, without exposing
        this state to the world.  In some cases it may be useful to
        make a unittest class a friend of the class it tests.
-->
        フレンドは通常、同じファイルに定義しておくべきだ。こうしておくとコードを読む人は、クラスのプライベートメンバが使われている場所を見つけるのに、他のファイルの中まで見る必要はなくなる。<code>friend</code> がよく使われるのは <code>FooBuilder</code> クラスを <code>Foo</code> のフレンドにするというものだ。これによって、<code>Foo</code> の内部状態を全員に公開することなく、<code>FooBuilder</code> クラスは正しくオブジェクトを構築することができる。ユニットテストのクラスを、テスト対象となるクラスのフレンドにしておくと便利な場合もある。
      </p>
      <p>
<!--
        Friends extend, but do not break, the encapsulation
        boundary of a class.  In some cases this is better than making
        a member public when you want to give only one other class
        access to it.  However, most classes should interact with
        other classes solely through their public members.
-->
        フレンドはクラスのカプセル化の範囲を拡大するものだが、破ることはない。他のクラス1つだけからアクセスできるようにしたい場合には、メンバをパブリックにするよりもよい場合がある。しかし、たいていのクラスは単にパブリックメンバを介して別のクラスとやり取りするべきだ。
      </p>
    </BODY>
  </STYLEPOINT>
<!--
  <STYLEPOINT title="Exceptions">
-->
  <STYLEPOINT title="例外">
    <SUMMARY>
<!--
      We do not use C++ exceptions.
-->
      C++の例外を使わない。
    </SUMMARY>
    <BODY>
      <PROS>
        <ul>
<!--
          <li>Exceptions allow higher levels of an application to
          decide how to handle "can't happen" failures in deeply
          nested functions, without the obscuring and error-prone
          bookkeeping of error codes.</li>
-->
          <li>例外を使うと、アプリケーションのずっと高いレベルで、深く入れ子になった関数で発生した「起こり得ない」失敗を処理するかどうかを決定することができる。曖昧な間違いの元になるエラーコードの一覧といったものは不要になる。</li>
          
<!--
          <li>Exceptions are used by most other modern
          languages.  Using them in C++ would make it more consistent with
          Python, Java, and the C++ that others are familiar with.</li>
-->
          <li>例外は最近の言語の多くで使われている。C++で例外を使うことは、PythonやJava、そしてみんながよく知っている C++とより一貫性を持たせることになる。</li>
<!--
          <li>Some third-party C++ libraries use exceptions, and turning
          them off internally makes it harder to integrate with those
          libraries.</li>
-->
          <li>サードパーティ製 C++ ライブラリには例外を使っているものがある。例外を内部で見せなくしてしまうと、そういったライブラリとの統合が難しくなる。</li>
<!--
          <li>Exceptions are the only way for a constructor to fail.
          We can simulate this with a factory function or an
          <code>Init()</code> method, but these require heap
          allocation or a new "invalid" state, respectively.</li>
-->
          <li>例外はコンストラクタが失敗したことを知る唯一の手段だ。ファクトリ関数や <code>Init()</code> メソッドによってこれをシミュレーションすることはできるが、それぞれヒープ割り当てや「不正な」状態が必要になる。</li>
<!--
          <li>Exceptions are really handy in testing frameworks.</li>
-->
          <li>例外はテストフレームワークにおいて本当に便利だ。</li>
        </ul>
      </PROS>
      <CONS>
        <ul>
<!--
          <li>When you add a <code>throw</code> statement to an existing
          function, you must examine all of its transitive callers. Either
          they must make at least the basic exception safety guarantee, or
          they must never catch the exception and be happy with the
          program terminating as a result. For instance, if
          <code>f()</code> calls <code>g()</code> calls
          <code>h()</code>, and <code>h</code> throws an exception
          that <code>f</code> catches, <code>g</code> has to be
          careful or it may not clean up properly.</li>
-->
          <li>既存の関数に <code>throw</code> 文を追加するときには、途中にある呼び出し元すべてを調査しなければならない。少なくとも基本的な例外の安全性を保証するか、例外を決して捕捉せずに結果としてプログラムが中断してしまうのを良しとしなければならない。例えば、<code>f()</code> が <code>g()</code> を呼び出し、<code>g()</code> が <code>h()</code> を呼び出し、<code>h</code> が  <code>f</code> により捕捉される例外を投げるなら、<code>g</code> は気をつける必要がある。さもなければ適切にクリーンナップされないかもしれない。</li>
<!--
          <li>More generally, exceptions make the control flow of
          programs difficult to evaluate by looking at code: functions
          may return in places you don't expect. This results
          maintainability and debugging difficulties. You can minimize
          this cost via some rules on how and where exceptions can be
          used, but at the cost of more that a developer needs to know
          and understand.</li>
-->
          <li>さらに一般的には、例外を使うと、コードを見ただけで制御の流れを理解するのは難しくなる。関数は予期せぬ場所で戻ってきてしまうかもしれない。この結果、メンテナンスやデバッグは困難になる。例外の使い方や使ってもよい場所にルールを設けることで、このコストを最小化することもできる。しかし、開発者がそのことを知って理解するのには、さらにコストがかかる。</li>
<!--
          <li>Exception safety requires both RAII and different coding
          practices. Lots of supporting machinery is needed to make
          writing correct exception-safe code easy. Further, to avoid
          requiring readers to understand the entire call graph,
          exception-safe code must isolate logic that writes to
          persistent state into a "commit" phase. This will have both
          benefits and costs (perhaps where you're forced to obfuscate
          code to isolate the commit). Allowing exceptions would force
          us to always pay those costs even when they're not worth
          it.</li>
-->
          <li>例外の安全性には、RAIIと難しいコーディングプラクティスの両方が必要になる。正しい例外セーフなコードを簡単に書けるようにするには、コンピュータによるたくさんの支援が必要だ。さらに、コードを読む人がコールグラフ全体を理解しなければならないのを避けるためには、例外セーフなコードは不変状態を書き込むロジックを「コミット」フェーズに分離しなければならない。これはメリットでもありコストにもなる（おそらくコミットを分離するためにコードを分かりにくくしなければならない）。たとえ例外にそれほど価値がなくても、常にコストになってしまう。</li>
<!--
          <li>Turning on exceptions adds data to each binary produced,
          increasing compile time (probably slightly) and possibly
          increasing address space pressure.
          </li>
-->
          <li>例外を有効にすると、生成されるバイナリが大きくなり、コンパイル時間が長くなり（おそらくわずか）、おそらくアドレス空間を圧迫することになる。</li>
<!--
          <li>The availability of exceptions may encourage developers
          to throw them when they are not appropriate or recover from
          them when it's not safe to do so. For example, invalid user
          input should not cause exceptions to be thrown. We would
          need to make the style guide even longer to document these
          restrictions!</li>
-->
          <li>例外を利用できるようにすると、開発者は適切でないときに例外を投げたり、安全でないときに例外から復帰しようとしてしまうおそれがある。例えば、不正なユーザ入力は例外を投げるべきではない。こうした制限を明文化しようとすると、スタイルガイドはもっと長くなってしまうだろう。</li>
        </ul>
      </CONS>
      <DECISION>
        <p>
<!--
          On their face, the benefits of using exceptions outweigh the
          costs, especially in new projects.  However, for existing code,
          the introduction of exceptions has implications on all dependent
          code.  If exceptions can be propagated beyond a new project, it
          also becomes problematic to integrate the new project into
          existing exception-free code.  Because most existing C++ code at
          Google is not prepared to deal with exceptions, it is
          comparatively difficult to adopt new code that generates
          exceptions.
-->
          見ての通り、例外を使うメリットはコストを上回る。特に新規プロジェクトの場合にはそうだ。しかし、既存のコードに例外を導入しようとすると、依存しているコードすべてに影響が及んでしまう。もし例外が新しいオブジェクト以外にも影響を与えてしまうのであれば、その新規プロジェクトを例外のない既存のコードに組み込むのは問題になる。Googleの既存のC++コードの多くは、例外を処理するようにできていないので、例外を生成するような新しいコードを採用するのは、どちらかと言うと難しい。
        </p>
        <p>
<!--
          Given that Google's existing code is not exception-tolerant, the
          costs of using exceptions are somewhat greater than the costs in
          in a new project.  The conversion process would be slow and
          error-prone.  We don't believe that the available alternatives to
          exceptions, such as error codes and assertions, introduce a
          significant burden.
-->      
          Googleの既存のコードに例外に対する耐性がないことを考えると、例外を使うコストは新規プロジェクトの場合のコストよりもいくらか大きくなる。この変換プロセスには時間がかかり、問題になることが多い。私たちはエラーコードやアサーションといった例外の代わりに使える方法が、大きな障害になるとは思っていない。
        </p>
        <p>
<!--
          Our advice against using exceptions is not predicated on
          philosophical or moral grounds, but practical ones.
          
          Because we'd like to use our open-source
          projects at Google and it's difficult to do so if those projects
          use exceptions, we need to advise against exceptions in Google
          open-source projects as well.
          Things would probably be different if we had to do it all over
          again from scratch.
-->
          例外を使うことへの反対意見は、賢明な、または、高潔な理由があるわけではなく、実践的なものだ。
          Googleではオープンソースプロジェクトを使いたいのだが、例外を使っているプロジェクトを使うのは難しい。したがって、Googleオープンソースプロジェクトでも例外に対して反対意見を述べざるを得ない。
         スクラッチからもう一度全部やり直さなければならないとしたら、おそらく考え方は違っていただろう。
        </p>
        <p>
<!--
          There is an <a HREF="#Windows_Code">exception</a> to this
          rule (no pun intended) for Windows code.
-->
          Windowsのコードに関しては、このルールは<a HREF="#Windows_Code">例外</a>だ（シャレじゃないよ）。
        </p>
      </DECISION>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Run-Time Type Information (RTTI)">-->
  <STYLEPOINT title="実行時型情報（RTTI）">
    <SUMMARY>
<!--
      We do not use Run Time Type Information (RTTI).
-->
      実行時型情報（RTTI）を使わない。
    </SUMMARY>
    <BODY>
      <DEFINITION>
<!--
        RTTI allows a programmer to query the C++ class of an
        object at run time.
-->
        RTTIを使うと、プログラマは実行時にオブジェクトのC++クラスを問い合わせることができる。
      </DEFINITION>
      <PROS>
        <p>
<!--
          It is useful in some unittests. For example, it is useful in
          tests of factory classes where the test has to verify that a
          newly created object has the expected dynamic type.
-->
         これはユニットテストの場合に便利だ。例えばファクトリクラスのテストにおいて、新しく生成されたオブジェクトが期待通りの動的な型であることを確認するのに便利だ。
        </p>
        <p>
<!--
          In rare circumstances, it is useful even outside of
          tests.
-->
          まれにテスト以外でも役に立つことがある。
        </p>
      </PROS>
      <CONS>
<!--
        A query of type during run-time typically means a
        design problem.  If you need to know the type of an
        object at runtime, that is often an indication that
        you should reconsider the design of your class.
-->
        実行時に型を問い合わせるということは、設計に問題があることが多い。実行時にオブジェクトの型を知る必要があるのなら、クラスの設計を再検討すべきだというサインかもしれない。
      </CONS>
      <DECISION>
        <p>
<!--
          Do not use RTTI, except in unittests.  If you find yourself
          in need of writing code that behaves differently based on
          the class of an object, consider one of the alternatives to
          querying the type.
-->
          ユニットテスト以外で RTTI を使ってはいけない。オブジェクトのクラスによって異なる動作をするコードを書く必要があるのなら、別の方法で型を問い合わせることを検討すること。
        </p>
        <p>
<!--
          Virtual methods are the preferred way of executing different
          code paths depending on a specific subclass type.  This puts
          the work within the object itself.
-->
          仮想メソッドは、サブクラスの型により異なるパスでコードを実行するのにふさわしい方法だ。処理はそのオブジェクトの内部に置くことになる。
        </p>
        <p>
<!--
          If the work belongs outside the object and instead in some
          processing code, consider a double-dispatch solution, such
          as the Visitor design pattern.  This allows a facility
          outside the object itself to determine the type of class
          using the built-in type system.
-->
          もし現在処理中のコード内ではなくオブジェクトの外部にその処理があるなら、Visitorデザインパターンのようなダブルディスパッチを使うことを検討しよう。ダブルディスパッチを使うと、オブジェクトの外部にあるものが組み込みの型システムを使ってクラスの型を決定することができる。
        </p>
        <p>
<!--
          If you think you truly cannot use those ideas,
          
          you may use RTTI.  But think twice
          about it.  :-)  Then think twice again.
          Do not hand-implement an RTTI-like workaround. The arguments
          against RTTI apply just as much to workarounds like class
          hierarchies with type tags.
-->
          どうしてもこうしたアイデアを使うことができないと思うのなら、RTTIを使っても構わない。しかしその前にもう一度考えよう。:-) その後、もう一度考えよう。
          RTTIに似たワークアラウンドを自前で実装してはいけない。RTTIに対する議論は、型タグを持つクラス階層のようなワークアラウンドにもほとんどそのまま当てはまる。
        </p>
      </DECISION>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Casting">-->
  <STYLEPOINT title="キャスト">
    <SUMMARY>
<!--
      Use C++ casts like <code>static_cast&lt;&gt;()</code>.  Do not use
      other cast formats like <code>int y = (int)x;</code> or
      <code>int y = int(x);</code>.
-->
      <code>static_cast&lt;&gt;()</code> といった、C++のキャストを使う。<code>int y = (int)x;</code> や <code>int y = int(x);</code> のような書式のキャストを使ってはいけない。
    </SUMMARY>
    <BODY>
      <DEFINITION>
<!--
        C++ introduced a different cast system from C that
        distinguishes the types of cast operations.
-->
        C++は、Cとは異なるキャストの仕組みを導入した。これはキャスト操作の種類を区別している。
      </DEFINITION>
      <PROS>
<!--
        The problem with C casts is the ambiguity of the operation;
        sometimes you are doing a <em>conversion</em> (e.g.,
        <code>(int)3.5</code>) and sometimes you are doing a
        <em>cast</em> (e.g., <code>(int)"hello"</code>); C++ casts
        avoid this.  Additionally C++ casts are more visible when
        searching for them.
-->
        Cのキャストには操作が不明確だという問題がある。 <em>変換</em>が行われることもあれば（例えば、<code>(int)3.5</code>）、<em>キャスト</em>が行われることもある（例えば、<code>(int)"hello"</code>）。C++のキャストを使うとこれを避けることができる。さらにC++のキャストは、探すときにも目で見てわかりやすい。
      </PROS>
      <CONS>
<!--
        The syntax is nasty.
-->
        構文が扱いにくい。
      </CONS>
      <DECISION>
        <p>
<!--
          Do not use C-style casts.  Instead, use these C++-style
          casts.
-->          
          Cスタイルのキャストを使ってはいけない。代わりに、C++スタイルのキャストを使うこと。
        </p>
        <ul>
<!--          
          <li> Use <code>static_cast</code> as the equivalent of a
               C-style cast that does value conversion, or when you need to explicitly up-cast
               a pointer from a class to its superclass.
-->
          <li> 値の変換を行うようなCスタイルのキャストの代わりとして、あるいは、あるクラスからそのスーパークラスにポインタを明示的にアップキャストする必要があるときには、<code>static_cast</code> を使うこと。
               </li>
<!--
          <li> Use <code>const_cast</code> to remove the <code>const</code>
               qualifier (see <a HREF="#Use_of_const">const</a>).
-->
          <li> <code>const</code> 修飾子（<a HREF="#Use_of_const">const</a>を参照すること）を取り除くためには、<code>const_cast</code> を使うこと。
               </li>
<!--          
          <li> Use <code>reinterpret_cast</code> to do unsafe
               conversions of pointer types to and from integer and
               other pointer types. Use this only if you know what you are
               doing and you understand the aliasing issues.
-->               
          <li> 整数やその他のポインタ型との安全ではないポインタ型の変換をするときには、<code>reinterpret_cast</code> を使うこと。何をやっているのかわかっていて、エイリアス問題を理解しているときだけ使うこと。
               </li>
<!--
          <li> Do not use <code>dynamic_cast</code> except in test code.
               If you need to know type information at runtime in this way
               outside of a unittest, you probably have a <A HREF="#Run-Time_Type_Information__RTTI_">design
               flaw</A>.
-->
          <li> テストコード以外で <code>dynamic_cast</code> を使ってはいけない。
               もしユニットテスト以外でこのように実行時に型情報を知る必要があるのであれば、おそらく<A HREF="#Run-Time_Type_Information__RTTI_">設計上の欠陥</A>がある。
               </li>
        </ul>
      </DECISION>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Streams">-->
  <STYLEPOINT title="ストリーム">
    <SUMMARY>
<!--
      Use streams only for logging.
-->
      ストリームはログ記録のためだけに使う。
    </SUMMARY>
    <BODY>
      <DEFINITION>
<!--
        Streams are a replacement for <code>printf()</code> and
        <code>scanf()</code>.
-->
        ストリームは <code>printf()</code> や <code>scanf()</code> の代わりだ。
      </DEFINITION>
      <PROS>
<!--
        With streams, you do not need to know the type of the object
        you are printing.  You do not have problems with format
        strings not matching the argument list.  (Though with gcc, you
        do not have that problem with <code>printf</code> either.)  Streams
        have automatic constructors and destructors that open and close the
        relevant files.
-->
        ストリームを使うと、プリントしているオブジェクトの型を知る必要がなくなる。書式文字列が引数リストとマッチしないという問題は起こらない。（しかし、gccであれば <code>printf</code> でも問題は起こらない）。ストリームには自動のコンストラクタとデストラクタがあり、対応するファイルのオープンとクローズを自動的にやってくれる。
      </PROS>
      <CONS>
<!--
        Streams make it difficult to do functionality like
        <code>pread()</code>.  Some formatting (particularly the common
        format string idiom <code>%.*s</code>) is difficult if not
        impossible to do efficiently using streams without using
        <code>printf</code>-like hacks.  Streams do not support operator
        reordering (the <code>%1s</code> directive), which is helpful for
        internationalization.
-->
        ストリームを使って <code>pread()</code> のような動作を実現するのは難しい。 <code>printf</code> のようなハックを使わずにストリームを使って効率よくやるのは、不可能ではないが複雑な書式になることがある（具体的には、よく見かける文字列イディオム <code>%.*s</code>）。ストリームは国際化に役立つオペレータの並び換え（<code>%1s</code> ディレクティブ）をサポートしていない。
      </CONS>
      <DECISION>
        
        <p>
<!--
          Do not use streams, except where required by a logging interface.
          Use <code>printf</code>-like routines instead.
-->
          ログ記録インタフェースで必要とされる場合を除いて、ストリームは使わないこと。代わりに <code>printf</code> といったルーチンを使うこと。
        </p>
        <p>
<!--
          There are various pros and cons to using streams, but in
          this case, as in many other cases, consistency trumps the
          debate.  Do not use streams in your code.
-->
          ストリームの利用については賛否両論ある。しかしこの場合にも、例によって、一貫性を持つことがどんな議論にも勝る。コードにストリームを使ってはいけない。
        </p>

<!--        <SUBSECTION title="Extended Discussion">-->
        <SUBSECTION title="さらなる議論">
          <p>
<!--
            There has been debate on this issue, so this explains the
            reasoning in greater depth.  Recall the Only One Way
            guiding principle: we want to make sure that whenever we
            do a certain type of I/O, the code looks the same in all
            those places.  Because of this, we do not want to allow
            users to decide between using streams or using
            <code>printf</code> plus Read/Write/etc.  Instead, we should
            settle on one or the other.  We made an exception for logging
            because it is a pretty specialized application, and for
            historical reasons.
-->
            この問題には長い議論があったので、もっと詳しく理由を説明しておこう。方法を1つにすることが原則を導くということを思い出そう。特定のI/Oの型を使うときにはいつでも、コードのどこであっても同じように見えるようにしたい。そのため、ストリームと read/writeなどや <code>printf</code> のどちらを使うのか、ユーザが決められるようにはしたくない。そうではなく、どちらか一つに決めておくべきだ。ただし、ログ記録については例外とした。これはかなり特殊なアプリケーションであり、歴史的な理由もあるためだ。
          </p>
          <p>
<!--
            Proponents of streams have argued that streams are the obvious
            choice of the two, but the issue is not actually so clear.  For
            every advantage of streams they point out, there is an
            equivalent disadvantage.  The biggest advantage is that
            you do not need to know the type of the object to be
            printing.  This is a fair point.  But, there is a
            downside: you can easily use the wrong type, and the
            compiler will not warn you.  It is easy to make this
            kind of mistake without knowing when using streams.
-->
            ストリームの提案者たちは、これら2つのうちからストリームが選ばれるのは疑う余地がないと主張していたが、実際には問題はそれほど明確なものではない。彼らが指摘するストリームの利点のすべてに対して、同じように欠点を挙げることができる。ストリームの最大の利点は、プリントするのにオブジェクトの型を知る必要がないことだ。これは疑う余地がない点だ。しかし、マイナス面もある。間違った型を使ってしまいやすく、コンパイラはそれを警告してくれない。ストリームを使うと、知らず知らずのうちにこのような間違いをしやすくなる。
          </p>
          <CODE_SNIPPET>
            cout &lt;&lt; this;  // アドレスをプリント
            cout &lt;&lt; *this;  // 内容をプリント
          </CODE_SNIPPET>
          <p>
<!--
            The compiler does not generate an error because
            <code>&lt;&lt;</code> has been overloaded.  We discourage
            overloading for just this reason.
-->
            この場合、コンパイラはエラーを吐かない。<code>&lt;&lt;</code> がオーバーロードされているためだ。そのために私たちはオーバーロードを使うことを推奨していない。
          </p>
          <p>
<!--
            Some say <code>printf</code> formatting is ugly and hard to
            read, but streams are often no better.  Consider the following 
            two fragments, both with the same typo.  Which is easier to
            discover?
-->
            <code>printf</code> は不細工で読みにくいという人もいるが、ストリームにも同じことが言えるだろう。次の2つのコードを見てみよう。どちらにも同じ typo がある。どちらの方が見つけやすいかな？
          </p>
          <CODE_SNIPPET>
             cerr &lt;&lt; "Error connecting to '" &lt;&lt; foo-&gt;bar()-&gt;hostname.first
                  &lt;&lt; ":" &lt;&lt; foo-&gt;bar()-&gt;hostname.second &lt;&lt; ": " &lt;&lt; strerror(errno);

             fprintf(stderr, "Error connecting to '%s:%u: %s",
                     foo-&gt;bar()-&gt;hostname.first, foo-&gt;bar()-&gt;hostname.second,
                     strerror(errno));
          </CODE_SNIPPET>
          <p>
<!--
            And so on and so forth for any issue you might bring up.
            (You could argue, "Things would be better with the right
            wrappers," but if it is true for one scheme, is it not
            also true for the other?  Also, remember the goal is to
            make the language smaller, not add yet more machinery that
            someone has to learn.)
-->
            その他にもいろいろと問題を挙げることができる。（あなたは「うまくラッパーを使えばもっとよくなる」と主張するかもしれない。しかしあるスキーマでそれが正しければ、他のスキーマでも正しいわけではないよね? それに目標は言語をもっと小さくすることであり、学習しなければならない仕組みをさらに追加することではない。）
          </p>
          <p>
<!--
            Either path would yield different advantages and
            disadvantages, and there is not a clearly superior
            solution.  The simplicity doctrine mandates we settle on
            one of them though, and the majority decision was on
            <code>printf</code> + <code>read</code>/<code>write</code>.
-->
            どちらをとっても異なる利点と欠点があり、はっきりと優れた解決策というものはない。しかし、シンプルさの原則に従って、どちらか1つに決めなければならなかった。結局、多数決で <code>printf</code> + <code>read</code>/<code>write</code> になった。
          </p>
        </SUBSECTION>
      </DECISION>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Preincrement and Predecrement">-->
  <STYLEPOINT title="前置インクリメントと前置デクリメント">
    <SUMMARY>
<!--
      Use prefix form (<code>++i</code>) of the increment and
      decrement operators with iterators and other template objects.
-->
      イテレータやその他のテンプレートオブジェクトでは、インクリメント演算子およびデクリメント演算子を前置形式（<code>++i</code>）で使う。
    </SUMMARY>
    <BODY>
      <DEFINITION>
<!--
        When a variable is incremented (<code>++i</code> or
        <code>i++</code>) or decremented (<code>- -i</code> or
        <code>i- -</code>) and the value of the expression is not used,
        one must decide whether to preincrement (decrement) or
        postincrement (decrement).
-->
        変数をインクリメントしたり（<code>++i</code> や <code>i++</code>）、デクリメントしたり（<code>--i</code> や <code>i--</code>）して、その式の値を使わないとき、前置インクリメント（デクリメント）か後置インクリメント（デクリメント）のどちらを使うか選ばなければならない。
      </DEFINITION>
      <PROS>
<!--
        When the return value is ignored, the "pre" form
        (<code>++i</code>) is never less efficient than the "post"
        form (<code>i++</code>), and is often more efficient.  This is
        because post-increment (or decrement) requires a copy of
        <code>i</code> to be made, which is the value of the
        expression.  If <code>i</code> is an iterator or other
        non-scalar type, copying <code>i</code> could be expensive.
        Since the two types of increment behave the same when the
        value is ignored, why not just always pre-increment?
-->
        戻り値が無視されるとき、「前置」形式（<code>++i</code>）は「後置」形式（<code>i++</code>）よりも効率が悪くなることはなく、効率がよくなることが多い。後置インクリメント（またはデクリメント）の場合、<code>i</code> のコピー（これが式の値になる）を作る必要があるためだ。もし<code>i</code>がイテレータであったり、非スカラ型であれば、<code>i</code> をコピーするコストは高くなるだろう。
        値が無視されるときにはこの2種類のインクリメントは同じような動作になるのに、どうして前置インクリメントだけにしないのか?
      </PROS>
      <CONS>
<!--
        The tradition developed, in C, of using post-increment when
        the expression value is not used, especially in <code>for</code>
        loops.  Some find post-increment easier to read, since the
        "subject" (<code>i</code>) precedes the "verb" (<code>++</code>),
        just like in English.
-->
        Cでは式の値が使われないとき、具体形には<code>for</code>では、後置インクリメントを使うという伝統がある。後置インクリメントの方が読みやすいという人もいる。英語と同じように「主語」（<code>i</code>）が「動詞」（<code>++</code>）の前にあるためだ。
      </CONS>
      <DECISION>
<!--
        For simple scalar (non-object) values there is no reason to
        prefer one form and we allow either.  For iterators and other
        template types, use pre-increment.
-->
        単純なスカラ（非オブジェクト）値には、どちらかを推奨する理由はなく、どちらを使っても構わない。イテレータやその他のテンプレート型には、前置インクリメントを使うこと。
      </DECISION>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Use of const">-->
  <STYLEPOINT title="constの使用">
    <SUMMARY>
<!--
      We strongly recommend that you use <code>const</code> whenever
      it makes sense to do so.
-->
      理にかなっているときには必ず <code>const</code> を使うことを強く推奨する。
    </SUMMARY>
    <BODY>
      <DEFINITION>
<!--
        Declared variables and parameters can be preceded by the
        keyword <code>const</code> to indicate the variables are not
        changed (e.g., <code>const int foo</code>).  Class functions
        can have the <code>const</code> qualifier to indicate the
        function does not change the state of the class member
        variables (e.g., <code>class Foo { int Bar(char c) const;
        };</code>).
-->
        その変数が変更されないことを示すために、変数やパラメータの宣言の前に <code>const</code> キーワードを付けることができる（例えば <code>const int foo</code>）。その関数がクラスメンバ変数の状態を変更しないことを示すために、クラス関数に  <code>const</code> という修飾子を付けることができる（例えば <code>class Foo { int Bar(char c) const; };</code>）。
      </DEFINITION>
      <PROS>
<!--
        Easier for people to understand how variables are being used.
        Allows the compiler to do better type checking, and,
        conceivably, generate better code.  Helps people convince
        themselves of program correctness because they know the
        functions they call are limited in how they can modify your
        variables.  Helps people know what functions are safe to use
        without locks in multi-threaded programs.
-->
        変数がどのように使われるのか理解しやすくなる。コンパイラはさらに型チェックをすることができ、おそらくよりよいコードを生成してくれる。呼び出している関数が、変数を変更するのを制限しているかどうかがわかるので、プログラムの正確さを確かめるのに役立つ。マルチスレッドプログラムにおいて、どの関数がロックなしで安全に使えるのかを知るのにも役立つ。
      </PROS>
      <CONS>
<!--
        <code>const</code> is viral: if you pass a <code>const</code>
        variable to a function, that function must have <code>const</code>
        in its prototype (or the variable will need a
        <code>const_cast</code>).  This can be a particular problem
        when calling library functions.
-->
        <code>const</code> は感染する。もし関数に <code>const</code> 変数を渡すなら、その関数はそのプロトタイプに <code>const</code> を付けておかなければならない（あるいは、変数は <code>const_cast</code> をしなければならない）。これはライブラリ関数を呼び出すときには特に問題になるおそれがある。
      </CONS>
      <DECISION>
        <p>
<!--
          <code>const</code> variables, data members, methods and
          arguments add a level of compile-time type checking; it
          is better to detect errors as soon as possible.
          Therefore we strongly recommend that you use
          <code>const</code> whenever it makes sense to do so:
-->
          <code>const</code> 変数、データメンバ、メソッド、引数はコンパイル時の型チェックのレベルを高めてくれる。できる限りすばやくエラーを検出することができる。
          そのため私たちは、理にかなっているときにはいつも <code>const</code> を使うことを強く推奨する。
        </p>
        <ul>
<!--
          <li> If a function does not modify an argument passed by
               reference or by pointer, that argument should be
               <code>const</code>.
-->
          <li> その関数がリファレンスやポインタで渡された引数を変更しないのであれば、引数に <code>const</code> を付けておくべきだ。
               </li>
<!--
          <li> Declare methods to be <code>const</code> whenever
               possible. Accessors should almost always be
               <code>const</code>. Other methods should be const if they do
               not modify any data members, do not call any
               non-<code>const</code> methods, and do not return a
               non-<code>const</code> pointer or non-<code>const</code>
               reference to a data member.
-->
          <li> メソッドはできる限り <code>const</code> だと宣言しておくこと。アクセサはほぼ必ず <code>const</code> になるはずだ。もしデータメンバを変更せず、非<code>const</code>メソッドを呼び出すこともなく、データメンバに対する非<code>const</code>ポインタや非<code>const</code>リファレンスを戻さないのであれば、そういうメソッドも const にすべきだ。
               </li>
<!--
          <li> Consider making data members <code>const</code>
               whenever they do not need to be modified after
               construction.
-->
          <li> 生成後に変更する必要のないデータメンバは必ず <code>const</code> にしておくことを検討すること。
               </li>
        </ul>
        <p>
<!--
          However, do not go crazy with <code>const</code>.  Something like
          <code>const int * const * const x;</code> is likely
          overkill, even if it accurately describes how const x is.
          Focus on what's really useful to know: in this case,
          <code>const int** x</code> is probably sufficient.
-->
          しかし、<code>const</code> を使おうとしすぎてもいけない。<code>const int * const * const x;</code> というコードはやりすぎだろう。たとえ x がどう const なのかを正確に記述していたとしてもね。
          わかって本当に意味のあるところにポイントを絞ろう。この場合おそらく、<code>const int** x</code> で十分だ。
        </p>
        <p>
<!--
          The <code>mutable</code> keyword is allowed but is unsafe
          when used with threads, so thread safety should be carefully
          considered first.
-->
          <code>mutable</code> キーワードを使っても構わないが、これはマルチスレッド環境では安全でない。スレッドセーフかどうかを最初に注意深く検討しておくべきだ。
        </p>
      </DECISION>
<!--      <SUBSECTION title="Where to put the const">-->
      <SUBSECTION title="const を書くべき場所">
        <p>
<!--
          Some people favor the form <code>int const *foo</code> to
          <code>const int* foo</code>.  They argue that this is more
          readable because it's more consistent: it keeps the rule
          that <code>const</code> always follows the object it's
          describing.  However, this consistency argument doesn't
          apply in this case, because the "don't go crazy" dictum
          eliminates most of the uses you'd have to be consistent with.
          
          Putting the <code>const</code> first is arguably more readable,
          since it follows English in putting the "adjective"
          (<code>const</code>) before the "noun" (<code>int</code>).
-->
          <code>const int* foo</code> よりも <code>int const *foo</code> という形式を好む人もいる。<code>const</code> は必ずそれが説明しているオブジェクトの次にくるというルールには一貫性があり、読みやすくなると主張している。しかし、一貫性というのはこの場合には当てはまらない。「やりすぎてはいけない」という言葉によって、一貫性を持つ必要があるというのをほとんど無効にするためだ。
         
          最初に <code>const</code> を置くと、ほぼ間違いなく読みやすくなる。「名詞」（<code>int</code>）の前に「形容詞」（<code>const</code>）を置くのが、英語と同じためだ。
        </p>
        <p>
<!--
          That said, while we encourage putting <code>const</code> first, 
          we do not require it.  But be consistent with the code around
          you!
-->
          <code>const</code> を最初に置くことを推奨するのだが、必須にはしていない。しかし、まわりのコードと一貫性を持たせること。
        </p>
      </SUBSECTION>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Integer Types">-->
  <STYLEPOINT title="整数型">
    <SUMMARY>
<!--
      Of the built-in C++ integer types, the only one used
      
      is <code>int</code>.  If a program needs a variable of a different
      size, use
      
      a precise-width integer type from
      <code>&lt;stdint.h&gt;</code>, such as <code>int16_t</code>.
-->
      組み込みのC++整数型のうち、使ってもよいのは <code>int</code> だけだ。プログラムに別のサイズの変数が必要であれば、 <code>&lt;stdint.h&gt;</code> にある <code>int16_t</code> といった固定幅の型を使うこと。
    </SUMMARY>
    <BODY>
      <DEFINITION>
<!--
        C++ does not specify the sizes of its integer types. Typically
        people assume that <code>short</code> is 16 bits,
        <code>int</code> is 32 bits, <code>long</code> is 32 bits and
        <code>long long</code> is 64 bits.
-->
        C++は整数型のサイズを規定していない。通常、<code>short</code>は16ビット、<code>int</code>は32ビット、<code>long</code>は32ビット、<code>long long</code>は64ビットになる。
      </DEFINITION>
      <PROS>
<!--
        Uniformity of declaration.
-->
        宣言の不変性。
      </PROS>
      <CONS>
<!--
        The sizes of integral types in C++ can vary based on compiler
        and architecture.
-->
        C++の整数型はコンパイラやアーキテクチャによって変わるかもしれない。
      </CONS>
      <DECISION>
        <p>
          
<!--
          <code>&lt;stdint.h&gt;</code> defines
          types like <code>int16_t</code>, <code>uint32_t</code>,
          <code>int64_t</code>, etc.
          You should always use those in preference to
          <code>short</code>, <code>unsigned long long</code> and the
          like, when you need a guarantee on the size of an integer.
          Of the C integer types, only <code>int</code> should be
          used.  When appropriate, you are welcome to use standard
          types like <code>size_t</code> and <code>ptrdiff_t</code>.
-->
          <code>&lt;stdint.h&gt;</code> には <code>int16_t</code>、<code>uint32_t</code>、<code>int64_t</code> といった型が定義されている。
          <code>short</code>、<code>unsigned long long</code> の代わりに、常にこれらを使うべきだ。Cの整数型のうち、使うのは <code>int</code> だけにすべきだ。必要があれば <code>size_t</code> や <code>ptrdiff_t</code> といった標準型を使ってもよい。

        </p>
        <p>
<!--
          We use <code>int</code> very often, for integers we know are not
          going to be too big, e.g., loop counters. Use plain old
          <code>int</code> for such things. You should assume that an
          <code>int</code> is
          
          at least 32 bits,
          but don't assume that it has more than 32 bits.
          If you need a 64-bit integer type, use
          <code>int64_t</code> or
          <code>uint64_t</code>.
-->
          私たちは <code>int</code> を非常によく使う。ループカウンタといった、それほど大きくならないのがわかっている整数のためだ。こういったものには昔からある <code>int</code> をそのまま使おう。<code>int</code> は少なくとも32ビットあると考えてもよいが、32ビット以上あるとは考えてはいけない。
          もし64ビットの整数型が必要であれば、<code>int64_t</code> や <code>uint64_t</code> を使うこと。
        </p>
        <p>
<!--
          For integers we know can be "big",
           use
          <code>int64_t</code>.
-->          
          「大きくなる」ことがわかっている整数には、<code>int64_t</code> を使うこと。
        </p>
        <p>
<!--
          You should not use the unsigned integer types such as
          <code>uint32_t</code>,
          unless the quantity you are representing is really a bit pattern

          rather than a number, or unless you need defined
          twos-complement overflow. In particular, do not use unsigned
          types to say a number will never be negative.  Instead, use
          assertions for this.
-->
          表現しているのが実際には数値ではなくビットパターンであったり、2の補数オーバーフローを定義する必要があるとき以外は、<code>uint32_t</code> といった unsigned 整数型を使うべきではない。特に、数値が負にならないと言うために unsigned 型を使ってはいけない。代わりにアサーションを使うこと。

        </p>
        
      </DECISION>

<!--      <SUBSECTION title="On Unsigned Integers">-->
      <SUBSECTION title="Unsigned Integer について">
        <p>
<!--
          Some people, including some textbook authors, recommend
          using unsigned types to represent numbers that are never
          negative.  This is intended as a form of self-documentation.
          However, in C, the advantages of such documentation are
          outweighed by the real bugs it can introduce.  Consider:
-->
          教科書を書いている人のなかには、負にならない数値を表現するのに unsigned 型を使うのを推奨している人たちもいる。これは自己文書化を意図しているためだ。しかしCでは、実際に引き起こされるバグが文書化のメリットを上回ってしまう。考えてみよう。
        </p>
        <CODE_SNIPPET>
          for (unsigned int i = foo.Length()-1; i &gt;= 0; --i) ...
        </CODE_SNIPPET>
        <p>
<!--
          This code will never terminate!  Sometimes gcc will notice
          this bug and warn you, but often it will not.  Equally bad
          bugs can occur when comparing signed and unsigned
          variables.  Basically, C's type-promotion scheme causes
          unsigned types to behave differently than one might expect.
-->
          このコードは止まらない! gccはこのバグに気づいて警告してくれるが、気づかないことも多い。同じように、signed と unsigned を比較するときにも、ひどいバグが引き起こされる場合がある。要するに、Cの型昇格の仕組みによって、unsigned 型は期待とは異なる動作になってしまうのだ。
        </p>
        <p>
<!--
          So, document that a variable is non-negative using
          assertions.
          Don't use an unsigned type.
-->
          そのため変数が負ではないことを示すにはアサーションを使うこと。unsigned 型を使ってはいけない。
        </p>
      </SUBSECTION>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="64-bit Portability">-->
  <STYLEPOINT title="64-bit 移植性">
    <SUMMARY>
<!--
      Code should be 64-bit and 32-bit friendly.  Bear in mind problems of
      printing, comparisons, and structure alignment.
-->
      コードは64ビットと32ビットの両方で動くようにしておくべきだ。プリント文、比較、構造体のアラインメントの問題を忘れないようにすること。
    </SUMMARY>
    <BODY>
      <ul>
        <li>
          <p>
<!--
            <code>printf()</code> specifiers for some types are
            not cleanly portable between 32-bit and 64-bit
            systems. C99 defines some portable format
            specifiers. Unfortunately, MSVC 7.1 does not
            understand some of these specifiers and the
            standard is missing a few, so we have to define our
            own ugly versions in some cases (in the style of the
            standard include file <code>inttypes.h</code>):
-->
            <code>printf()</code> の指定子には、32ビットシステムと64ビットシステムとの間で移植性があるかはっきりしていないものがある。C99は移植性のある書式指定子をいくつか定義している。残念ながらMSVC 7.1はこうした指定子のいくつかを理解できず、標準は少し欠けている。そのため場合によっては、自分で不細工なバージョンを定義する必要がある（標準のインクルードファイル <code>inttypes.h</code> のスタイルで）。
          </p>
          <CODE_SNIPPET>
            // size_t のための printf マクロ。inttypes.h のスタイルで。
            #ifdef _LP64
            #define __PRIS_PREFIX "z"
            #else
            #define __PRIS_PREFIX
            #endif

            // これらのマクロを32/64ビットの両方で正しく動かすために、
            // 次のように、printf 書式文字列では % の後に入れること。
            // size_t size = records.size();
            // printf("%"PRIuS"\n", size);

            #define PRIdS __PRIS_PREFIX "d"
            #define PRIxS __PRIS_PREFIX "x"
            #define PRIuS __PRIS_PREFIX "u"
            #define PRIXS __PRIS_PREFIX "X"
            #define PRIoS __PRIS_PREFIX "o"
          </CODE_SNIPPET>
<!--
          <table border="1" summary="portable printf specifiers">
-->
          <table border="1" summary="移植性のある printf 指定子">
            <TBODY>
              <tr align="center">
<!--
                <th>Type</th>
                <th>DO NOT use</th>
                <th>DO use</th>
                <th>Notes</th>
-->
                <th>型</th>
                <th>使ってはいけない</th>
                <th>使ってもいい</th>
                <th>注意</th>
              </tr>
              <tr align="center">
                <td><code>void *</code> （あるいは任意のポインタ）</td>
                <td><code>%lx</code></td>
                <td><code>%p</code></td>
                <td> </td>
              </tr>
              
              <tr align="center">
                <td><code>int64_t</code></td>
                <td><code>%qd</code>,
                     <code>%lld</code></td>
                <td><code>%"PRId64"</code></td>
                <td/>
              </tr>
              
              <tr align="center">
                <td><code>uint64_t</code></td>
                <td><code>%qu</code>,
                    <code>%llu</code>,
                    <code>%llx</code></td>
                <td><code>%"PRIu64"</code>,
                    <code>%"PRIx64"</code></td>
                <td/>
              </tr>
              
              <tr align="center">
                <td><code>size_t</code></td>
                <td><code>%u</code></td>
                <td><code>%"PRIuS"</code>,
                    <code>%"PRIxS"</code></td>
                <td>C99では <code>%zu</code></td>
              </tr>
              <tr align="center">
                <td><code>ptrdiff_t</code></td>
                <td><code>%d</code></td>
                <td><code>%"PRIdS"</code></td>
                <td>C99では <code>%zd</code></td>
              </tr>
              
            </TBODY>
          </table>
          <p>
<!--
            Note that the <code>PRI*</code> macros expand to independent
            strings which are concatenated by the compiler. Hence
            if you are using a non-constant format string, you
            need to insert the value of the macro into the format,
            rather than the name. It is still possible, as usual,
            to include length specifiers, etc., after the
            <code>%</code> when using the <code>PRI*</code>
            macros. So, e.g.  <code>printf("x = %30"PRIuS"\n",
            x)</code> would expand on 32-bit Linux to
            <code>printf("x = %30" "u" "\n", x)</code>, which the
            compiler will treat as <code>printf("x = %30u\n",
            x)</code>.
-->
            <code>PRI*</code> マクロは、コンパイラによって連結された独立した文字列に展開されることに注意すること。そのため定数ではない書式文字列を使う場合には、その名前ではなくマクロの値を書式に入れておく必要がある。<code>PRI*</code> マクロを使うときには、<code>%</code> の後に長さ指定子などを入れておくと必ずそうすることができる。例えば、<code>printf("x = %30"PRIuS"\n", x)</code> は32ビットLinuxでは <code>printf("x = %30" "u" "\n", x)</code>に展開され、コンパイラは<code>printf("x = %30u\n", x)</code> として処理することになる。
          </p>
          
          </li>
<!--
        <li> Remember that <code>sizeof(void *)</code> !=
             <code>sizeof(int)</code>.  Use <code>intptr_t</code> if
             you want a pointer-sized integer.
-->
        <li> <code>sizeof(void *)</code> != <code>sizeof(int)</code> であることを覚えておこう。もしポインタサイズの整数が必要なら <code>intptr_t</code> を使うこと。
             </li>
<!--
        <li> You may need to be careful with structure alignments,
             particularly for structures being stored on disk. Any
             class/structure with a
             
             <code>int64_t</code>/<code>uint64_t</code>
             member will by default end up being 8-byte aligned on a 64-bit
             system. If you have such structures being shared on disk
             between 32-bit and 64-bit code, you will need to ensure
             that they are packed the same on both architectures.
             
             Most compilers offer a way to alter
             structure alignment.  For gcc, you can use
             <code>__attribute__((packed))</code>.  MSVC offers
             <code>#pragma pack()</code> and
             <code>__declspec(align())</code>.
-->
        <li> 構造体のアラインメントにも注意する必要があるかもしれない。特に、構造体をディスク上に格納する場合には必要になる。クラスや構造体に <code>int64_t</code>/<code>uint64_t</code> のメンバがあるときには、64ビットシステムにおけるアラインメントはデフォルトで8バイトになる。32ビットと64ビットコードの間でディスク上で共有されている構造体などがあれば、両方のアーキテクチャで同じになるようパックしてあるか確認する必要があるだろう。

             たいていのコンパイラには構造体のアラインメントを変える方法がある。例えば gcc の場合、<code>__attribute__((packed))</code> を使うことができる。MSVCの場合には、<code>#pragma pack()</code> と <code>__declspec(align())</code> を使うことができる。
             </li>
        <li>
<!--             
             Use the <code>LL</code> or <code>ULL</code> suffixes as
             needed to create 64-bit constants.  For example:
-->             
             64ビット定数を用意する必要があるときには、<code>LL</code> や <code>ULL</code> というサフィックスを使うこと。例えば次のようになる。

             <CODE_SNIPPET>
             int64_t my_value = 0x123456789LL;
             uint64_t my_mask = 3ULL &lt;&lt; 48;
             </CODE_SNIPPET>
             </li>
<!--
        <li> If you really need different code on 32-bit and 64-bit
             systems, use <code>#ifdef _LP64</code> to choose between
             the code variants. (But please avoid this if
             possible, and keep any such changes localized.)
-->
        <li> 本当に32ビットシステムと64ビットシステムで異なるコードが必要であれば、コードを分岐させるのに <code>#ifdef _LP64</code> を使うこと。（ただし、できればこれを避けて、変更が局所的になるようにすること）
             </li>
      </ul>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Preprocessor Macros">-->
  <STYLEPOINT title="プリプロセッサのマクロ">
    <SUMMARY>
<!--
      Be very cautious with macros.  Prefer inline functions, enums,
      and <code>const</code> variables to macros.
-->
      マクロには十分注意する。マクロを使うよりもインライン関数や enum、<code>const</code> 変数を使う方が望ましい。
    </SUMMARY>
    <BODY>
      <p>
<!--
        Macros mean that the code you see is not the same as the code
        the compiler sees.  This can introduce unexpected behavior,
        especially since macros have global scope.
-->
        マクロを使うということは、あなたが見ているコードとコンパイラが見ているコードは同じではなくなるということだ。これは予期せぬ動作を引き起こすことがある。特に、マクロがグローバルスコープにあるときには起こりやすい。
      </p>
      <p>
<!--
        Luckily, macros are not nearly as necessary in C++ as they are
        in C.  Instead of using a macro to inline performance-critical
        code, use an inline function.  Instead of using a macro to
        store a constant, use a <code>const</code> variable.  Instead of
        using a macro to "abbreviate" a long variable name, use a
        reference.  Instead of using a macro to conditionally compile code
        ... well, don't do that at all (except, of course, for the
        <code>#define</code> guards to prevent double inclusion of
        header files).  It makes testing much more difficult.
-->
        幸運にも、C++ではCほどマクロは必要にならない。パフォーマンスに影響を及ぼすコードをインライン化するためには、マクロではなくインライン関数を使うこと。定数を格納するためには、マクロではなく <code>const</code> 変数を使うこと。長い変数名を省略するためには、マクロではなくリファレンスを使うこと。コードを条件付きコンパイルするためには、マクロではなく、いや、そもそもそんなことをしてはいけない（もちろん、ヘッダファイルの二重インクルードを防ぐための <code>#define</code> ガードは除く）。そんなことをするとテストがとても難しくなる。
      </p>
      <p>
<!--
        Macros can do things these other techniques cannot, and you do
        see them in the codebase, especially in the lower-level
        libraries.  And some of their special features (like
        stringifying, concatenation, and so forth) are not available
        through the language proper.  But before using a macro,
        consider carefully whether there's a non-macro way to achieve
        the same result.
-->
        こうした他のやり方ではできない場合には、マクロを使っても構わない。コードベース、特に低レベルのライブラリの中では見かけることがある。また、特別な機能には、言語によってはうまく利用できないものもある（文字列化、連結など）。しかしマクロを使う前には、マクロを使わないで同じ結果を達成する方法がないか注意深く検討すること。
      </p>
      <p>
<!--
        The following usage pattern will avoid many problems with
        macros; if you use macros, follow it whenever possible:
-->
        次に示す利用パターンに従うと、マクロを使ったときの問題の多くを避けることができるだろう。マクロを使うときにはできるだけ以下に従うこと。
      </p>
      <ul>
<!--
        <li> Don't define macros in a <code>.h</code> file.
-->
        <li> <code>.h</code> ファイルにマクロを定義してはいけない。
             </li>
<!--
        <li> <code>#define</code> macros right before you use them,
             and <code>#undef</code> them right after.
-->
        <li> 使う直前に <code>#define</code> マクロを置き、使った直後に <code>#undef</code> すること。
             </li>
<!--
        <li> Do not just <code>#undef</code> an existing macro before
             replacing it with your own; instead, pick a name that's
             likely to be unique.
-->
        <li> 既存のマクロを自分のもので置き換えたいからといって、既存のマクロを <code>#undef</code> してはいけない。代わりに一意な名前を持つマクロにすること。
             </li>
<!--
        <li> Try not to use macros that expand to unbalanced C++
             constructs, or at least document that behavior well.
-->
        <li> アンバランスなC++構造体を拡張するためにマクロを使ってはいけない。さもなければ、少なくともその動作についてしっかり明記しておくこと。
             </li>
      </ul>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="0 and NULL">-->
  <STYLEPOINT title="0 と NULL">
  <SUMMARY>
<!--
    Use <code>0</code> for integers, <code>0.0</code> for reals,
    <code>NULL</code> for pointers, and <code>'\0'</code> for chars.
-->
   整数には <code>0</code> を、実数には <code>0.0</code> を、ポインタには <code>NULL</code> を、文字には <code>'\0'</code> を使う。
  </SUMMARY>
  <BODY>
    <p>
<!--
      Use <code>0</code> for integers and <code>0.0</code> for reals.
      This is not controversial.
-->
      整数には <code>0</code> を使い、実数には  <code>0.0</code> を使うこと。これには賛否両論ある。
    </p>
    <p>
<!--
      For pointers (address values), there is a choice between <code>0</code>
      and <code>NULL</code>.  Bjarne Stroustrup prefers an unadorned
      <code>0</code>.  We prefer <code>NULL</code> because it looks like a
      pointer.  In fact, some C++ compilers, such as gcc 4.1.0, provide special
      definitions of <code>NULL</code> which enable them to give useful
      warnings, particularly in situations where <code>sizeof(NULL)</code>
      is not equal to <code>sizeof(0)</code>.
-->
      ポインタ（アドレス値）には、<code>0</code> と <code>NULL</code> という選択肢がある。 Bjarne Stroustrup は簡素な <code>0</code> の方を好んでいる。私たちは <code>NULL</code> の方が好きだ。この方がポインタらしく見えるためだ。実際のところ、C++コンパイラには gcc 4.1.0 のように、役に立つ警告ができるよう <code>NULL</code> に特別な定義付けをしているものもある。具体的に言うと、<code>sizeof(NULL)</code> は  <code>sizeof(0)</code> と等しくない、という警告を出してくれる。
    </p>
    <p>
<!--
      Use <code>'\0'</code> for chars.
      This is the correct type and also makes code more readable.
-->
      文字には <code>'\0'</code> を使うこと。
     これは型も正しく、コードも読みやすくなる。
    </p>
  </BODY>
  </STYLEPOINT>

  <STYLEPOINT title="sizeof">
  <SUMMARY>
<!--
    Use <code>sizeof(<var>varname</var>)</code> instead of
    <code>sizeof(<var>type</var>)</code> whenever possible.
-->
    できる限り <code>sizeof(<var>型</var>)</code> ではなく <code>sizeof(<var>変数名</var>)</code> を使う。
  </SUMMARY>
  <BODY>
    <p>
<!--
      Use <code>sizeof(<var>varname</var>)</code> because it will update
      appropriately if the type of the variable changes.
      <code>sizeof(<var>type</var>)</code> may make sense in some cases,
      but should generally be avoided because it can fall out of sync if
      the variable's type changes.
-->
      <code>sizeof(<var>変数名</var>)</code> を使うこと。こうしておくと、もし変数の型を変更してもうまく更新されるためだ。
      <code>sizeof(<var>型</var>)</code> の方が理にかなっている場合もあるが、一般的には避けるべきだ。変数の型を変更すると一致しなくなるおそれがある。
    </p>
    <p>
      <CODE_SNIPPET>
        Struct data;
        memset(&amp;data, 0, sizeof(data));
      </CODE_SNIPPET>
      <BAD_CODE_SNIPPET>
        memset(&amp;data, 0, sizeof(Struct));
      </BAD_CODE_SNIPPET>
    </p>
  </BODY>
  </STYLEPOINT>

  <STYLEPOINT title="Boost">
  <SUMMARY>
<!--
    Use only approved libraries from the Boost library collection.
-->
    Boostライブラリ群のうち許可されているライブラリだけを使う。
  </SUMMARY>
  <BODY>
    <DEFINITION>
<!--
      The <a href="http://www.boost.org/">Boost library collection</a> is
      a popular collection of peer-reviewed, free, open-source C++ libraries.
-->
      <a href="http://www.boost.org/">Boostライブラリコレクション</a>は人気がある、よくレビューされたフリーのオープンソースC++ライブラリ集だ。
    </DEFINITION>
    <PROS>
<!--
      Boost code is generally very high-quality, is widely portable, and fills
      many important gaps in the C++ standard library, such as type traits,
      better binders, and better smart pointers. It also provides an
      implementation of the TR1 extension to the standard library.
-->
      Boostのコードは一般的に非常に高品質で、移植性がよく、C++標準ライブラリにあるたくさんの大きなギャップを、type traints（型特性）や、よりよい binder やスマートポインタといったもので埋めてくれる。これはまた、標準ライブラリに対するTR1拡張の実装も提供している。
    </PROS>
    <CONS>
<!--
      Some Boost libraries encourage coding practices which can hamper
      readability, such as metaprogramming and other advanced template
      techniques, and an excessively "functional" style of programming.
-->
      Boostライブラリには、読みやすさを妨げるようなコーディングプラクティスを促すものもある。メタプログラミングや先進的なテンプレートテクニック、行き過ぎた「関数」スタイルのプログラミングといったものだ。
    </CONS>
    
    <DECISION>
<!--      
      In order to maintain a high level of readability for all contributors
      who might read and maintain code, we only allow an approved subset of
      Boost features.  Currently, the following libraries are permitted:
-->
      コードを読んでメンテナンスをするコントリビュータ（貢献者）全員にとって読みやすいようにするため、私たちはBoost機能のサブセットだけ、使うことを許している。現在のところ、次のライブラリが許可されている。
      <ul>
<!--
        <li> <a href="http://www.boost.org/libs/utility/compressed_pair.htm">
             Compressed Pair</a> from <code>boost/compressed_pair.hpp</code>
-->
        <li> <a href="http://www.boost.org/libs/utility/compressed_pair.htm">
             Compressed Pair</a>（<code>boost/compressed_pair.hpp</code>）
             </li>
<!--
        <li> <a href="http://www.boost.org/libs/ptr_container/">
             Pointer Container</a> from <code>boost/ptr_container</code> except serialization
-->
        <li> <a href="http://www.boost.org/libs/ptr_container/">
             Pointer Container</a>（<code>boost/ptr_container</code>）ただしシリアライゼーションを除く。
             </li>
<!--
        <li> <a href="http://www.boost.org/libs/array/">
             Array</a> from <code>boost/array.hpp</code>
-->
        <li> <a href="http://www.boost.org/libs/array/">
             Array</a>（<code>boost/array.hpp</code>）
             </li>
<!--
        <li> <a href="http://www.boost.org/libs/graph/">
             The Boost Graph Library (BGL)</a> from <code>boost/graph</code> except serialization
-->
        <li> <a href="http://www.boost.org/libs/graph/">
             Boost Graph Library（BGL）</a>（<code>boost/graph</code>）ただしシリアライゼーションを除く。
             </li>
<!--
        <li> <a href="http://www.boost.org/libs/property_map/">
             Property Map</a> from <code>boost/property_map.hpp</code>
-->
        <li> <a href="http://www.boost.org/libs/property_map/">
             Property Map</a>（<code>boost/property_map.hpp</code>）
             </li>
<!--
        <li> The part of
             <a href="http://www.boost.org/libs/iterator/">
             Iterator</a> that deals with defining iterators:
             <code>boost/iterator/iterator_adaptor.hpp</code>,
             <code>boost/iterator/iterator_facade.hpp</code>, and
             <code>boost/function_output_iterator.hpp</code></li>
-->
        <li> <a href="http://www.boost.org/libs/iterator/">
             Iterator</a> の一部。次のイテレータの定義に対応するもの。
             <code>boost/iterator/iterator_adaptor.hpp</code>、
             <code>boost/iterator/iterator_facade.hpp</code>、
             <code>boost/function_output_iterator.hpp</code></li>
      </ul>
<!--
      We are actively considering adding other Boost features to the list, so
      this rule may be relaxed in the future.
-->
      私たちはこの他のBoost機能をリストに追加することを積極的に検討している。そのため、このルールは将来緩和されるかもしれない。
    </DECISION>
  </BODY>
  </STYLEPOINT>

</CATEGORY>

<!-- <CATEGORY title="Naming">-->
<CATEGORY title="命名規則">
  <p>
<!--
    The most important consistency rules are those that govern
    naming. The style of a name immediately informs us what sort of
    thing the named entity is: a type, a variable, a function, a
    constant, a macro, etc., without requiring us to search for the
    declaration of that entity. The pattern-matching engine in our
    brains relies a great deal on these naming rules.
-->    
    一貫性を保つ上で最も重要なルールは命名に関するものだ。命名スタイルがあると、名付けられたものが何であるのか、型や変数、関数、定数、マクロといったことがすぐにわかるようになる。宣言を探す必要はなくなる。頭の中のパターンマッチングエンジンは命名規則をとても頼りにしている。
  </p>
  <p>
<!--
    Naming rules are pretty arbitrary, but
    
    we feel that consistency is more important than individual preferences
    in this area, so regardless of whether you find them sensible or not,
    the rules are the rules.
-->
    命名規則というものはかなりいい加減なものだが、個人の好みよりも一貫性を持つことの方が重要だと考えている。だから、理にかなっていると感じようが感じまいが、ルールはルールだ。
  </p>

<!--  <STYLEPOINT title="General Naming Rules">-->
  <STYLEPOINT title="一般的な命名規則">
    <SUMMARY>
<!--
      Function names, variable names, and filenames should be
      descriptive; eschew abbreviation.  Types and variables should be
      nouns, while functions should be "command" verbs.
-->
      関数名、変数名、ファイル名はわかりやすいものにするべきだ。省略は避けること。型や変数は名詞に、関数は「命令」の動詞にするべきだ。
    </SUMMARY>
    <BODY>
<!--      <SUBSECTION title="How to Name">-->
      <SUBSECTION title="命名法">
        <p>
<!--
          Give as descriptive a name as possible, within reason. Do
          not worry about saving horizontal space as it is far more
          important to make your code immediately understandable by a
          new reader. Examples of well-chosen names:
-->
          無理のない範囲で、できるだけわかりやすい名前にすること。スペースを節約しようとしてはいけない。新しくコードを読む人がすぐに理解できるようすることの方が、はるかに重要だ。よい名前の例を以下に挙げる。
        </p>
        <CODE_SNIPPET>
          int num_errors;                  // よい。
          int num_completed_connections;   // よい。
        </CODE_SNIPPET>
        <p>
<!--
          Poorly-chosen names use ambiguous abbreviations or arbitrary
          characters that do not convey meaning:
-->
          よくない名前とは、曖昧な省略や意味のないいい加減な言葉を使うことだ。
        </p>
        <BAD_CODE_SNIPPET>
          int n;                           // よくない - 意味がない。
          int nerr;                        // よくない - 曖昧な略語。
          int n_comp_conns;                // よくない - 曖昧な略語。
        </BAD_CODE_SNIPPET>
        <p>
<!--
          Type and variable names should typically be nouns: e.g.,
          <code>FileOpener</code>, 
          
          <code>num_errors</code>.
-->
          型と変数の名前は通常、名詞にするべきだ。例えば、<code>FileOpener</code>、<code>num_errors</code>。
        </p>
        <p>
<!--
          Function names should typically be imperative (that is they
          should be commands): e.g., <code>OpenFile()</code>,
          <code>set_num_errors()</code>.  There is an exception for
          accessors, which, described more completely in <a HREF="#Function_Names">Function Names</a>, should be named
          the same as the variable they access.
-->
          関数名は通常、命令的なものにするべきだ（つまりコマンドにするべきだ）。例えば <code>OpenFile()</code>、<code>set_num_errors()</code>。アクセサは例外であって、アクセスする変数と同じ名前にしておくこと。<a HREF="#Function_Names">関数名</a>で詳しく説明している。
        </p>
      </SUBSECTION>

<!--      <SUBSECTION title="Abbreviations">-->
      <SUBSECTION title="略語">
        <p>
<!--
          Do not use abbreviations unless they are extremely well
          known outside your project. For example:
-->
          プロジェクト外で極めてよく知られた言葉でない限り、略語を使ってはいけない。例:
        </p>
        <CODE_SNIPPET>
          // よい
          // これらは省略のない適切な名前だ。
          int num_dns_connections;  // たいていの人は "DNS" が何を示しているのか知っている。
          int price_count_reader;   // OK、price count. 意味がわかる。
        </CODE_SNIPPET>
        <BAD_CODE_SNIPPET>
          // よくない!
          // こうした略語は小さなグループ外では混乱したり、曖昧になるおそれがある。
          int wgc_connections;  // これが何を示しているのかわかるのはあなたのグループだけだ。
          int pc_reader;        // いろいろなものが "pc" という略語にされている。
        </BAD_CODE_SNIPPET>
        <p>
<!--
          Never abbreviate by leaving out letters:
-->
          文字を削って短縮してはいけない。
        </p>
        <CODE_SNIPPET>
          int error_count;  // よい。
        </CODE_SNIPPET>
        <BAD_CODE_SNIPPET>
          int error_cnt;    // よくない。
        </BAD_CODE_SNIPPET>
      </SUBSECTION>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="File Names">-->
  <STYLEPOINT title="ファイル名">
    <SUMMARY>
<!--
      Filenames should be all lowercase and can include underscores
      (<code>_</code>) or dashes (<code>-</code>).  Follow the
      convention that your
      
      project
      uses.
-->
      ファイル名はすべて小文字にするべきだ。アンダースコア（<code>_</code>）やダッシュ（<code>-</code>）が含まれていてもよい。プロジェクトで使っている規約に従うこと。
    </SUMMARY>
    <BODY>
      <p>
<!--
        Examples of acceptable file names:
-->
        許されるファイル名の例。
      </p>
      <p>
        <code>
          my_useful_class.cc<br/>
          my-useful-class.cc<br/>
          myusefulclass.cc<br/>
        </code>
      </p>
      <p>
<!--
        C++ files should end in <code>.cc</code> and header files
        should end in <code>.h</code>.
-->
        C++ファイルは <code>.cc</code> で終わるべきであり、ヘッダファイルは <code>.h</code> で終わるべきだ。
      </p>
      <p>
<!--
        Do not use filenames that already exist
        in <code>/usr/include</code>, such as <code>db.h</code>.
-->
        <code>db.h</code> のようにすでに<code>/usr/include</code>に存在するファイル名を使ってはいけない。
      </p>
      <p>
<!--
        In general, make your filenames very specific.  For example,
        use <code>http_server_logs.h</code> rather
        than <code>logs.h</code>.  A very common case is to have a
        pair of files called, e.g., <code>foo_bar.h</code>
        and <code>foo_bar.cc</code>, defining a class
        called <code>FooBar</code>.
-->
        一般に、ファイル名は非常に具体的なものにすること。例えば、<code>logs.h</code> ではなく <code>http_server_logs.h</code> とすること。例えば、<code>FooBar</code> というクラスを定義するときには、<code>foo_bar.h</code> と <code>foo_bar.cc</code> というファイルのペアを使うことが非常に多い。
      </p>
      <p>
<!--
        Inline functions must be in a <code>.h</code> file. If your
        inline functions are very short, they should go directly into your
        <code>.h</code> file. However, if your inline functions
        include a lot of code, they may go into a third file that
        ends in <code>-inl.h</code>.  In a class with a lot of inline
        code, your class could have three files:
-->
        インライン関数は <code>.h</code> ファイルに入れなければならない。インライン関数が非常に簡潔であれば、<code>.h</code> ファイルの中に直接書いておくべきだ。しかし、インライン関数にたくさんのコードが含まれるのであれば、<code>-inl.h</code> で終わる別のファイルに入れてもよい。インラインコードがたくさんあるクラスは、3つのファイルから構成されることになる。
      </p>
      <CODE_SNIPPET>
        url_table.h      // クラスの宣言
        url_table.cc     // クラスの定義
        url_table-inl.h  // たくさんのコードを含むインライン関数
      </CODE_SNIPPET>
      <p>
<!--
        See also the section <a href="#The_-inl.h_Files">-inl.h Files</a>
-->
        <a href="#The_-inl.h_Files">-inl.h ファイル</a>のセクションも参照すること。
      </p>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Type Names">-->
  <STYLEPOINT title="型名">
    <SUMMARY>
<!--
      Type names start with a capital letter and have a capital
      letter for each new word, with no underscores:
      <code>MyExcitingClass</code>, <code>MyExcitingEnum</code>.
-->
      型名は大文字で始めて、単語の頭文字を大文字にする。アンダースコアは使わない。<code>MyExcitingClass</code>、<code>MyExcitingEnum</code>などとする。
    </SUMMARY>
    <BODY>
      <p>
<!--
        The names of all types &#8212; classes, structs, typedefs, and enums
        &#8212; have the same naming convention.  Type names should start
        with a capital letter and have a capital letter for each new
        word.  No underscores.  For example:
-->
        あらゆる型、&#8212; クラス、構造体、typedef、enum &#8212; の名前には同じ命名規約を使う。型名は大文字で始めて、単語の先頭を大文字にするべきだ。アンダースコアは使わない。例:
      </p>
      <CODE_SNIPPET>
        // クラスと構造体
        class UrlTable { ...
        class UrlTableTester { ...
        struct UrlTableProperties { ...

        // typedefs
        typedef hash_map&lt;UrlTableProperties *, string&gt; PropertiesMap;

        // enums
        enum UrlTableErrors { ...
      </CODE_SNIPPET>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Variable Names">-->
  <STYLEPOINT title="変数名">
    <SUMMARY>
<!--
      Variable names are all lowercase, with underscores between
      words.  Class member variables have trailing underscores.  For
      instance: <code>my_exciting_local_variable</code>,
      <code>my_exciting_member_variable_</code>.
-->
      変数名はすべて小文字にして、単語と単語の間にはアンダースコアを入れる。クラスメンバ変数はアンダースコアで終わるようにする。例えば、<code>my_exciting_local_variable</code>、<code>my_exciting_member_variable_</code>。
    </SUMMARY>
    <BODY>
<!--      <SUBSECTION title="Common Variable names">-->
      <SUBSECTION title="よく使う変数名">
        <p>
<!--
          For example:
-->
          例:
        </p>
        <CODE_SNIPPET>
          string table_name;  // OK - アンダースコアを使っている。
          string tablename;   // OK - すべて小文字だ。
        </CODE_SNIPPET>
        <BAD_CODE_SNIPPET>
          string tableName;   // よくない - 大文字小文字が混ざっている。
        </BAD_CODE_SNIPPET>
      </SUBSECTION>

<!--      <SUBSECTION title="Class Data Members">-->
      <SUBSECTION title="クラスのデータメンバ">
        <p>
<!--
          Data members (also called instance variables or member
          variables) are lowercase with optional underscores like
          regular variable names, but always end with a trailing
          underscore.
-->
          データメンバ（インスタンス変数やメンバ変数とも呼ばれる）は通常の変数名と同様に、アンダースコアを含む小文字にする。ただし、必ずアンダースコアで終わること。
        </p>
        <CODE_SNIPPET>
          string table_name_;  // OK - アンダースコアで終わる
          string tablename_;   // OK.
        </CODE_SNIPPET>
      </SUBSECTION>

<!--      <SUBSECTION title="Struct Variables">-->
      <SUBSECTION title="構造体の変数">
        <p>
<!--
          Data members in structs should be named like regular
          variables without the trailing underscores that data members
          in classes have.
-->
          構造体のデータメンバは、クラスのデータメンバにおける末尾のアンダースコアを除いて、通常の変数と同様に命名すべきだ。
        </p>
        <CODE_SNIPPET>
          struct UrlTableProperties {
            string name;
            int num_entries;
          }
        </CODE_SNIPPET>
        <p>
<!--
          See <a HREF="#Structs_vs._Classes">Structs vs. Classes</a> for a
          discussion of when to use a struct versus a class.
-->
          構造体とクラスをどう使い分けるかについては、<a HREF="#Structs_vs._Classes">構造体 対 クラス</a>を参照しよう。
        </p>
      </SUBSECTION>

<!--      <SUBSECTION title="Global Variables">-->
      <SUBSECTION title="グローバル変数">
        <p>
<!--
          There are no special requirements for global variables,
          which should be rare in any case, but if you use one,
          consider prefixing it with <code>g_</code> or some other
          marker to easily distinguish it from local variables.
-->
          グローバル変数については特別な決まりはない。グローバル変数はめったに使うべきではないが、もし使うのであれば <code>g_</code> などのプレフィックスを付けてローカル変数と区別しやすくすることを検討しよう。
        </p>
      </SUBSECTION>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Constant Names">-->
  <STYLEPOINT title="定数名">
    <SUMMARY>
<!--
      Use a <code>k</code> followed by mixed case:
      <code>kDaysInAWeek</code>.
-->
      <code>k</code>で始まり、大文字小文字で続ける。<code>kDaysInAWeek</code>
    </SUMMARY>
    <BODY>
      <p>
<!--
        All compile-time constants, whether they are declared locally,
        globally, or as part of a class, follow a slightly different
        naming convention from other variables. Use a <code>k</code>
        followed by words with uppercase first letters:
-->
        コンパイル時定数は、それがローカルであろうとグローバルであろうと、クラスの一部としてであろうと、どう宣言されていても、他の変数とは全然違う命名規約に従うこと。<code>k</code> の後に単語の先頭を大文字にして続けること。
      </p>
      <CODE_SNIPPET>
        const int kDaysInAWeek = 7;
      </CODE_SNIPPET>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Function Names">-->
  <STYLEPOINT title="関数名">
    <SUMMARY>
<!--
      Regular functions have mixed case; accessors and mutators match
      the name of the variable: <code>MyExcitingFunction()</code>,
      <code>MyExcitingMethod()</code>,
      <code>my_exciting_member_variable()</code>,
      <code>set_my_exciting_member_variable()</code>.
-->
      通常の関数は大文字小文字の組み合わせにする。アクセサやミューテータは変数名と一致させる。
      <code>MyExcitingFunction()</code>,
      <code>MyExcitingMethod()</code>,
      <code>my_exciting_member_variable()</code>,
      <code>set_my_exciting_member_variable()</code>
    </SUMMARY>
    <BODY>
<!--      <SUBSECTION title="Regular Functions"> -->
      <SUBSECTION title="通常の関数">
        <p>
<!--
          Functions should start with a capital letter and have a
          capital letter for each new word. No underscores:
-->
          関数名は大文字で始めて、単語の先頭を大文字にするべきだ。アンダースコアは使わない。
        </p>
        <CODE_SNIPPET>
          AddTableEntry()
          DeleteUrl()
        </CODE_SNIPPET>
      </SUBSECTION>

<!--      <SUBSECTION title="Accessors and Mutators">-->
      <SUBSECTION title="アクセサとミューテータ">
        <p>
<!--
          Accessors and mutators (get and set functions) should match
          the name of the variable they are getting and setting.  This
          shows an excerpt of a class whose instance variable is
          <code>num_entries_</code>.
-->
          アクセサとミューテータ（get/set 関数）は取得および設定しようとする変数名と一致させるべきだ。以下は、<code>num_entries_</code> というインスタンス変数を持つクラスの一部を示している。
        </p>
        <CODE_SNIPPET>
          class MyClass {
           public:
            ...
            int num_entries() const { return num_entries_; }
            void set_num_entries(int num_entries) { num_entries_ = num_entries; }

           private:
            int num_entries_;
          };
        </CODE_SNIPPET>
        <p>
<!--
          You may also use lowercase letters for other very short
          inlined functions. For example if a function were so cheap
          you would not cache the value if you were calling it in a
          loop, then lowercase naming would be acceptable.
-->
          非常に簡潔なインライン関数には小文字を使っても構わない。例えば、ループの中でその関数を読んでも値をキャッシュしないような非常に簡単なものであれば、小文字で命名してもよい。
        </p>
      </SUBSECTION>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Namespace Names">-->
  <STYLEPOINT title="名前空間名">
    
    <SUMMARY>
<!--
      Namespace names are all lower-case, and based on project names and
      possibly their directory structure:
      <code>google_awesome_project</code>.
-->
      名前空間名はすべて小文字にし、プロジェクト名と可能ならディレクトリ構造に基づいた名前にする。例えば <code>google_awesome_project</code>。
    </SUMMARY>
    <BODY>
      <p>
<!--
        See <a HREF="#Namespaces">Namespaces</a> for a discussion of
        namespaces and how to name them.
-->
        名前空間とその命名については、<a HREF="#Namespaces">名前空間</a>を参照しよう。
      </p>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Enumerator Names">-->
  <STYLEPOINT title="列挙子名">
    <SUMMARY>
<!--
      Enumerators should be named <i>either</i> like
      <A HREF="#Constant_Names">constants</A> or like
      <A HREF="#Macro_Names">macros</A>: either <code>kEnumName</code>
      or <code>ENUM_NAME</code>.
-->
      列挙子の名前は、<A HREF="#Constant_Names">定数</A> か <A HREF="#Macro_Names">マクロ</A> のようにするべきだ。つまり、<code>kEnumName</code> か <code>ENUM_NAME</code> 。
    </SUMMARY>
    <BODY>
      <p>
<!--
        Preferably, the individual enumerators should be named like
        <A HREF="#Constant_Names">constants</A>.  However, it is also
        acceptable to name them like <A HREF="#Macro_Names">macros</A>.    The enumeration name,
        <code>UrlTableErrors</code> (and
        <code>AlternateUrlTableErrors</code>), is a type, and
        therefore mixed case.
-->
        できれば、個々の列挙子は <A HREF="#Constant_Names">定数</A> のようにするべきだ。しかし、<A HREF="#Macro_Names">マクロ</A> のようであっても構わない。列挙型名  <code>UrlTableErrors</code>（そして、<code>AlternateUrlTableErrors</code>）は型であり、これは大文字と小文字を組み合わせた名前にする。
      </p>
      <CODE_SNIPPET>
        enum UrlTableErrors {
          kOK = 0,
          kErrorOutOfMemory,
          kErrorMalformedInput,
        };
        enum AlternateUrlTableErrors {
          OK = 0,
          OUT_OF_MEMORY = 1,
          MALFORMED_INPUT = 2,
        };
      </CODE_SNIPPET>
      <p>
<!--
        Until January 2009, the style was to name enum values like
        <A HREF="#Macro_Names">macros</A>.  This caused problems with
        name collisions between enum values and macros.  Hence, the
        change to prefer constant-style naming was put in place.  New
        code should prefer constant-style naming if possible.
        However, there is no reason to change old code to use
        constant-style names, unless the old names are actually
        causing a compile-time problem.
-->
        2009年1月までは、enum値は <A HREF="#Macro_Names">マクロ</A> のように命名するというスタイルだった。これはenum値とマクロの名前の衝突という問題を引き起こした。そのため、定数スタイルの命名の方がよいという変更をした。新しいコードはできるだけ定数スタイルの命名にするべきだ。しかし、古い命名が実際にコンパイル時の問題を引き起していないのであれば、古いコードを定数スタイルの命名に変更する理由はない。
      </p>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Macro Names">-->
  <STYLEPOINT title="マクロ名">
    <SUMMARY>
<!--
      You're not really going to <A HREF="#Preprocessor_Macros">define
      a macro</A>, are you?  If you do, they're like this:
      <code>MY_MACRO_THAT_SCARES_SMALL_CHILDREN</code>.
-->
      本当に<A HREF="#Preprocessor_Macros">マクロを定義</A>しようとは思ってないよね？ もしマクロを定義するなら、このようにする。
      <code>MY_MACRO_THAT_SCARES_SMALL_CHILDREN</code>
    </SUMMARY>
    <BODY>
      <p>
<!--
        Please see the <a href="#Preprocessor_Macros">description of
        macros</a>; in general macros should <em>not</em> be used.
        However, if they are absolutely needed, then they should be
        named like enum value names with all capitals and underscores.
-->
        <a href="#Preprocessor_Macros">マクロの説明</a>を参照しよう。一般的にマクロは使うべきでは<em>ない</em>。しかしどうしても必要であれば、enum値の名前のように、大文字とアンダースコアだけを使った名前にするべきだ。
      </p>
      <CODE_SNIPPET>
        #define ROUND(x) ...
        #define PI_ROUNDED 3.0
      </CODE_SNIPPET>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Exceptions to Naming Rules">-->
  <STYLEPOINT title="命名規則の例外">
    <SUMMARY>
<!--
      If you are naming something that is analogous to an existing C
      or C++ entity then you can follow the existing naming convention
      scheme.
-->
      もしCやC++に既にあるものに似ているものに名前を付けようとしているなら、既存の命名規約に従っても構わない。
    </SUMMARY>
    <BODY>
      <p>
        <dl>
          <dt> <code>bigopen()</code> </dt>
<!--
          <dd>   function name, follows form of <code>open()</code> </dd>
-->
          <dd> 関数名。<code>open()</code> の形に従う</dd>
          <dt> <code>uint</code> </dt>
          <dd>   <code>typedef</code> </dd>
          <dt> <code>bigpos</code> </dt>
<!--
          <dd>   <code>struct</code> or <code>class</code>, follows form of
                 <code>pos</code> </dd>
-->
          <dd>   <code>struct</code> や <code>class</code>。 <code>pos</code> の形に従う。</dd>
          <dt> <code>sparse_hash_map</code> </dt>
<!--          <dd>   STL-like entity; follows STL naming conventions </dd>-->
          <dd>   STLに似たエンティティ: STL の命名規約に従う。 </dd>
          <dt> <code>LONGLONG_MAX</code> </dt>
<!--          <dd>   a constant, as in <code>INT_MAX</code> </dd>-->
          <dd>定数。<code>INT_MAX</code> と同様。</dd>
        </dl>
      </p>
    </BODY>
  </STYLEPOINT>
</CATEGORY>

<!--<CATEGORY title="Comments">-->
<CATEGORY title="コメント">
  <p>
<!--
    Though a pain to write, comments are absolutely vital to keeping our
    code readable.  The following rules describe what you should
    comment and where.  But remember: while comments are very
    important, the best code is self-documenting.  Giving sensible
    names to types and variables is much better than using obscure
    names that you must then explain through comments.
-->
    コメントを書くのは苦痛だが、コードを読みやすくしておくためには不可欠だ。以下のルールは、どこにどんなコメントを書くべきかを説明したものだ。
    しかし忘れないでほしい。コメントはとても重要だが、最高のコードとは自己文書化されたコードだ。曖昧な名前を付けてコメントで説明しようとするよりも、型や変数に理にかなった名前を付けておく方がはるかによい。
  </p>
  <p>
<!--
    When writing your comments, write for your audience: the next
    
    contributor
    who will need to understand your code.  Be generous &#8212; the next
    one may be you!
-->
    コメントを書くときには、コードを読む人のために書こう。つまりコードを理解する必要のある次のコントリビュータ（貢献者）のためだ。親切になろう &#8212; 次のコントリビュータ（貢献者）というのはあなた自身のことかもしれないよ!
  </p>

  

<!--  <STYLEPOINT title="Comment Style">-->
    <STYLEPOINT title="コメントのスタイル">
    <SUMMARY>
<!--
      Use either the <code>//</code> or <code>/* */</code> syntax, as long
      as you are consistent.
-->
      <code>//</code> か <code>/* */</code> か、どちらかの構文を、一貫性を持って使う。
    </SUMMARY>
    <BODY>
      <p>
<!--
        You can use either the <code>//</code> or the <code>/* */</code>
        syntax; however, <code>//</code> is <em>much</em> more common.
        Be consistent with how you comment and what style you use where.
-->
        <code>//</code> か <code>/* */</code> のどちらの構文を使ってもよい。しかし、<code>//</code> の方が<em>かなり</em>よくみかける。
        どのようにコメントをするのか、どんなスタイルでどこにコメントするのか、一貫性を持たせること。
      </p>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="File Comments">-->
  <STYLEPOINT title="ファイルのコメント">
    <SUMMARY>
<!--
      Start each file with a copyright notice, followed by a
      description of the contents of the file.
-->
      各ファイルはコピーライト宣言から始める。その後に、ファイル内容の説明を書く。
    </SUMMARY>
    <BODY>
<!--      <SUBSECTION title="Legal Notice and Author Line">-->
        <SUBSECTION title="Legal Noticeと作者に関する行">        
        
        <p>
<!--
          Every file should contain the following items, in order:
-->
          すべてのファイルには、以下の項目をこの順序で入れておくべきだ。
          <ul>
<!--
            <li>a copyright statement (for example,
                <code>Copyright 2008 Google Inc.</code>)</li>
            <li>a license boilerplate.  Choose the appropriate boilerplate
                for the license used by the project (for example,
                Apache 2.0, BSD, LGPL, GPL)</li>
            <li>an author line to identify the original author of the
                file</li>
-->
            <li>コピーライトに関する文（例えば、
                <code>Copyright 2008 Google Inc.</code>）</li>
            <li>ライセンスの決まり文句。 そのプロジェクトで使うライセンスに合わせて選ぶこと。（例えば、
                Apache 2.0, BSD, LGPL, GPL）</li>
            <li>ファイルの原作者がわかるような作者に関する行</li>
          </ul>
        </p>
        <p>
<!--
          If you make significant changes to a file that someone else
          originally wrote, add yourself to the author line. This can
          be very helpful when another
          
          contributor
          has questions about the file and needs to know whom to contact
          about it.
-->
          もともと他人が書いたファイルに大きな変更をしたときには、作者のところに自分の名前を追加しよう。これは、他のコントリビュータ（貢献者）がそのファイルについて質問をしたり、問い合わせ先を知る必要があるときに、とても役に立つ。

        </p>
      </SUBSECTION>

<!--      <SUBSECTION title="File Contents">-->
      <SUBSECTION title="ファイルの内容">
        <p>
<!--
          Every file should have a comment at the top, below the
          and author line, that describes the contents of the file.
-->
          各ファイルの先頭（作者に関する行の下）には、ファイルの内容について書いたコメントを入れておくべきだ。
        </p>
        <p>
<!--
          Generally a <code>.h</code> file will describe the classes
          that are declared in the file with an overview of what they
          are for and how they are used. A <code>.cc</code> file
          should contain more information about implementation details
          or discussions of tricky algorithms. If you feel the
          implementation details or a discussion of the algorithms
          would be useful for someone reading the <code>.h</code>,
          feel free to put it there instead, but mention in the
          <code>.cc</code> that the documentation is in the
          <code>.h</code> file.
-->
          <code>.h</code> ファイルでは通常 、そのファイルで宣言しているクラスがどんなもので、どのように使うのか、概略を説明する。<code>.cc</code> ファイルには詳細実装やトリッキーなアルゴリズムの解説について詳しい情報を入れておくべきだ。もし<code>.h</code> を読む人にとって実装詳細やアルゴリズムの解説が役に立つと思うのであれば、<code>.h</code> に入れておいても構わない。ただし <code>.cc</code> ファイルには、ドキュメントが <code>.h</code> にあることを明記しておくこと。
        </p>
        <p>
<!--
          Do not duplicate comments in both the <code>.h</code> and
          the <code>.cc</code>. Duplicated comments diverge.
-->
          <code>.h</code> と <code>.cc</code> にあるコメントをコピーしてはいけない。コピーするとコメントが枝分かれしてしまうためだ。
        </p>
      </SUBSECTION>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Class Comments">-->
  <STYLEPOINT title="クラスのコメント">
    <SUMMARY>
<!--
      Every class definition should have an accompanying comment that
      describes what it is for and how it should be used.
-->
      クラス定義にはすべて、そのクラスが何のためにあり、どのように使われるべきかを説明するコメントを付けておくべきだ。
    </SUMMARY>
    <BODY>
      <CODE_SNIPPET>
        // Iterates over the contents of a GargantuanTable.  Sample usage:
        // (GargantuanTable の中身をイテレートする。使い方の例)
        //    GargantuanTable_Iterator* iter = table-&gt;NewIterator();
        //    for (iter-&gt;Seek("foo"); !iter-&gt;done(); iter-&gt;Next()) {
        //      process(iter-&gt;key(), iter-&gt;value());
        //    }
        //    delete iter;
        class GargantuanTable_Iterator {
          ...
        };
      </CODE_SNIPPET>
      <p>
<!--
        If you have already described a class in detail in the
        comments at the top of your file feel free to simply state
        "See comment at top of file for a complete description", but
        be sure to have some sort of comment.
-->
        クラスの詳細について、すでにファイルの先頭で説明しているのであれば、"See comment at top of file for a complete description"（「詳しくはファイル先頭のコメントを参照」）と記載しても構わないが、必ず何らかのコメントを入れておくこと。
      </p>
      <p>
<!--
        Document the synchronization assumptions the class makes, if
        any.  If an instance of the class can be accessed by multiple
        threads, take extra care to document the rules and invariants
        surrounding multithreaded use.
-->
        もしクラスが想定している同期があるのであれば、それについて書いておこう。もしクラスのインスタンスが複数のスレッドからアクセスされる可能性があるのなら、マルチスレッドの利用に関するルールや不変条件が明記してあるか、十分注意すること。
      </p>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Function Comments">-->
  <STYLEPOINT title="関数のコメント">
    <SUMMARY>
<!--
      Declaration comments describe use of the function; comments at
      the definition of a function describe operation.
-->
      関数宣言のコメントには関数の使い方を書く。関数定義のコメントには処理内容を書く。
    </SUMMARY>
    <BODY>
<!--      <SUBSECTION title="Function Declarations">-->
      <SUBSECTION title="関数宣言">
        <p>
<!--
          Every function declaration should have comments immediately
          preceding it that describe what the function does and how to
          use it.  These comments should be descriptive ("Opens the
          file") rather than imperative ("Open the file"); the comment
          describes the function, it does not tell the function what
          to do.  In general, these comments do not describe how the
          function performs its task.  Instead, that should be left to
          comments in the function definition.
-->
          すべての関数宣言には、その関数が何をするもので、どうやって使うのかを説明するコメントをその関数の直前に入れておくべきだ。このコメントは命令調（「ファイルをオープンしろ」）ではなく説明調（「ファイルをオープンする」）にしておくべきだ。コメントは関数について説明するものであって、関数が何をしているのかを説明するものではない。一般的に宣言のコメントは、関数があるタスクをどのようにやっているかを説明するものではない。これは関数宣言ではなく関数定義のコメントに入れておくべきだ。
        </p>
        <p>
<!--
          Types of things to mention in comments at the function
          declaration:
-->
          関数宣言のコメントで言及すべきもの。
        </p>
        <ul>
<!--
          <li> What the inputs and outputs are.
-->
          <li> 入出力が何であるか。
               </li>
<!--
          <li> For class member functions:  whether the object
               remembers reference arguments beyond the
               duration of the method call, and whether it will
               free them or not.
-->
          <li> クラスメンバ関数に関して、そのオブジェクトがメソッドを呼び出している期間以上にリファレンス引数を覚えているかどうか、それらを解放するのかしないのか。
               </li>
<!--
          <li> If the function allocates memory that the caller
               must free.
-->
          <li> 呼び出し側が解放しなければならないメモリをその関数が割り当てているかどうか
               </li>
<!--
          <li> Whether any of the arguments can be <code>NULL</code>.
-->
          <li> いずれかの引数が <code>NULL</code> になるおそれがあるかどうか。
               </li>
<!--
          <li> If there are any performance implications of how a
               function is used.
-->
          <li> 関数の使い方によってパフォーマンスに影響があるかどうか。
               </li>
<!--
          <li> If the function is re-entrant.  What are its
               synchronization assumptions?
-->
          <li> 関数がリエントラントかどうか。想定している同期は何か？
               </li>
        </ul>
        <p>
<!--
          Here is an example:
-->
          以下に例を挙げよう。
        </p>
        <CODE_SNIPPET>
          // Returns an iterator for this table.  It is the client's
          // responsibility to delete the iterator when it is done with it,
          // and it must not use the iterator once the GargantuanTable object
          // on which the iterator was created has been deleted.
          //
          // The iterator is initially positioned at the beginning of the table.
          //
          // This method is equivalent to:
          //    Iterator* iter = table-&gt;NewIterator();
          //    iter-&gt;Seek("");
          //    return iter;
          // If you are going to immediately seek to another place in the
          // returned iterator, it will be faster to use NewIterator()
          // and avoid the extra seek.
          Iterator* GetIterator() const;
        </CODE_SNIPPET>
        <p>
<!--
          However, do not be unnecessarily verbose or state the
          completely obvious.  Notice below that it is not necessary
          to say "returns false otherwise" because this is implied.
-->
          不必要に冗長にしたり、完璧に明確に記述しようとしてはいけない。以下のように「さもなければ false を返す」と書く必要はない。これは書かなくてもわかることだ。
        </p>
        <CODE_SNIPPET>
          // Returns true if the table cannot hold any more entries.
          // （テーブルがこれ以上エントリを保持できないとき true を返す。）
          bool IsTableFull();
        </CODE_SNIPPET>
        <p>
<!--
          When commenting constructors and destructors, remember that
          the person reading your code knows what constructors and
          destructors are for, so comments that just say something like
          "destroys this object" are not useful.  Document what
          constructors do with their arguments (for example, if they
          take ownership of pointers), and what cleanup the destructor
          does.  If this is trivial, just skip the comment.  It is
          quite common for destructors not to have a header comment.
-->
          コンストラクタとデストラクタにコメントを入れるときには、コードを読む人は何のコンストラクタとデストラクタであるかわかっていることを覚えておこう。「オブジェクトを破棄する」のようなコメントには意味がない。コンストラクタがその引数をどう処理するのか（例えばそれらにポインタのオーナーシップがあるなら）、デストラクタは何を解放するのか、といったことをコメントに入れよう。ささいなことであれば、コメントに入れなくてもいい。デストラクタにヘッダコメントがないことはかなりよくあることだ。
        </p>
      </SUBSECTION>

<!--      <SUBSECTION title="Function Definitions">-->
      <SUBSECTION title="関数定義">
        <p>
<!--
          Each function definition should have a comment describing
          what the function does and anything tricky about how it does
          its job.  For example, in the definition comment you might
          describe any coding tricks you use, give an overview of the
          steps you go through, or explain why you chose to implement
          the function in the way you did rather than using a viable
          alternative.  For instance, you might mention why it must
          acquire a lock for the first half of the function but why it
          is not needed for the second half.
-->
          それぞれの関数定義には、その関数がやることと、トリッキーなことをしているところを説明するコメントを入れておくべきだ。例えば、関数定義には、使っているコーディングテクニックを説明するコメントを入れておいたり、処理ステップの概要を説明したり、なぜ別の案ではなくその実装方法を選んだのかを説明しよう。例えば、なぜ関数の前半でロックを取得しなければならず、後半はその必要がないのか説明するとよい。
        </p>
        <p>
<!--
          Note you should <em>not</em> just repeat the comments given
          with the function declaration, in the <code>.h</code> file or
          wherever.  It's okay to recapitulate briefly what the function
          does, but the focus of the comments should be on how it does it.
-->
          <code>.h</code> やどこかにある関数宣言のコメントを繰り返すだけでは<em>いけない</em>ことに注意しよう。その関数が何であるかを短く要約するのにはいいが、コメントのポイントはどのようにそれをやるのかにあるべきだ。
        </p>
      </SUBSECTION>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Variable Comments">-->
  <STYLEPOINT title="変数のコメント">
    <SUMMARY>
<!--
      In general the actual name of the variable should be descriptive
      enough to give a good idea of what the variable is used for.  In
      certain cases, more comments are required.
-->
      一般的に、変数名は説明的なものにして、その変数が何のために使われるのかわかるようにすべきだ。さらにコメントが必要になる場合もある。
    </SUMMARY>
    <BODY>
<!--      <SUBSECTION title="Class Data Members">-->
      <SUBSECTION title="クラスデータメンバ">
        <p>
<!--
          Each class data member (also called an instance variable or
          member variable) should have a comment describing what it is
          used for.  If the variable can take sentinel values with
          special meanings, such as <code>NULL</code> or -1, document this.
          For example:
-->
          それぞれのクラスデータメンバには（インスタンス変数やメンバ変数と呼ばれることがある）、何のために使われるのかを説明するコメントを入れておくべきだ。もし変数が <code>NULL</code> や -1 といった特別な意味のある値を番人として扱うのであれば、そのことを明記しておこう。例:
        </p>
        <CODE_SNIPPET>
          private:
           // Keeps track of the total number of entries in the table.
           // Used to ensure we do not go over the limit. -1 means
           // that we don't yet know how many entries the table has.
           int num_total_entries_;
        </CODE_SNIPPET>
      </SUBSECTION>

<!--      <SUBSECTION title="Global Variables">-->
      <SUBSECTION title="グローバル変数">
        <p>
<!--
          As with data members, all global variables should have a
          comment describing what they are and what they are used for.
          For example:
-->
          データメンバに関して、グローバル変数にはすべて、それが何であり何のために使われるのかを説明するコメントを入れておくべきだ。例:
        </p>
        <CODE_SNIPPET>
          // The total number of tests cases that we run through in this regression test.
          // （回帰テストで実行するテストケースの総数）
          const int kNumTestCases = 6;
        </CODE_SNIPPET>
      </SUBSECTION>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Implementation Comments">-->
  <STYLEPOINT title="実装のコメント">
    <SUMMARY>
<!--
      In your implementation you should have comments in tricky,
      non-obvious, interesting, or important parts of your code.
-->
      実装においては、コードのトリッキーなところ、不明瞭なところ、興味深いところ、重要なところにコメントを入れておくべきだ。
    </SUMMARY>
    <BODY>
<!--      <SUBSECTION title="Class Data Members">-->
      <SUBSECTION title="クラスデータメンバ">
        <p>
<!--
          Tricky or complicated code blocks should have comments
          before them. Example:
-->
          トリッキーまたは複雑なコードブロックには、その直前にコメントを入れておくべきだ。例:
        </p>
        <CODE_SNIPPET>
          // Divide result by two, taking into account that x
          // contains the carry from the add.
          for (int i = 0; i &lt; result-&gt;size(); i++) {
            x = (x &lt;&lt; 8) + (*result)[i];
            (*result)[i] = x &gt;&gt; 1;
            x &amp;= 1;
          }
        </CODE_SNIPPET>
      </SUBSECTION>
<!--      <SUBSECTION title="Line Comments">-->
      <SUBSECTION title="行のコメント">
        <p>
<!--
          Also, lines that are non-obvious should get a comment at the
          end of the line. These end-of-line comments should be
          separated from the code by 2 spaces.  Example:
-->
          わかりにくい行にはその行の末尾にコメントを入れておくべきだ。そして行末コメントは、コードからスペース2つ空けておくべきだ。例:
        </p>
        <CODE_SNIPPET>
          // If we have enough memory, mmap the data portion too.
          // もしメモリが十分あれば、データ部分も mmap する。
          mmap_budget = max&lt;int64&gt;(0, mmap_budget - index_-&gt;length());
          if (mmap_budget &gt;= data_size_ &amp;&amp; !MmapData(mmap_chunk_bytes, mlock))
            return;  // Error already logged. （エラーはログ記録される。）
        </CODE_SNIPPET>
        <p>
<!--
          Note that there are both comments that describe what the
          code is doing, and comments that mention that an error has
          already been logged when the function returns.
-->
          そのコードが何をしているのかを説明しているコメントと、関数が戻るときにはエラーがすでにログ記録されていることについて述べているコメントがあることに注意しよう。
        </p>
        <p>
<!--
          If you have several comments on subsequent lines, it can
          often be more readable to line them up:
-->
          もしコメントが複数行にわたるのであれば、一列に並べると読みやすくなることが多い。
        </p>
        <CODE_SNIPPET>
          DoSomething();                  // Comment here so the comments line up.
          DoSomethingElseThatIsLonger();  // Comment here so there are two spaces between
                                          // the code and the comment.
          { // One space before comment when opening a new scope is allowed,
            // thus the comment lines up with the following comments and code.
            DoSomethingElse();  // Two spaces before line comments normally.
          }
        </CODE_SNIPPET>
      </SUBSECTION>
      <SUBSECTION title="NULL, true/false, 1, 2, 3...">
        <p>
<!--
          When you pass in <code>NULL</code>, boolean, or literal integer
          values to functions, you should consider adding a comment about
          what they are, or make your code self-documenting by using
          constants. For example, compare:
-->
          関数に <code>NULL</code> や boolean、リテラル整数値を渡すときには、それが何であるかをコメントに書いたり、定数を使って自己文書化したコードにすることを検討すべきだ。例えば、以下を比べてみよう。
        </p>
        <BAD_CODE_SNIPPET>
          bool success = CalculateSomething(interesting_value,
                                            10,
                                            false,
                                            NULL);  // これらの引数は何だろう??
        </BAD_CODE_SNIPPET>
        <p>
<!--
          versus:
-->
          これに対して次のようにする:
        </p>
        <CODE_SNIPPET>
          bool success = CalculateSomething(interesting_value,
                                            10,     // Default base value.（デフォルトのベース値。）
                                            false,  // Not the first time we're calling this.（これを呼び出すのは初めてではない。）
                                            NULL);  // No callback.（コールバックなし。）
        </CODE_SNIPPET>
        <p>
<!--
          Or alternatively, constants or self-describing variables:
-->
          あるいは代わりに、定数や自己文書化した変数を使ってもよい:
        </p>
        <CODE_SNIPPET>
          const int kDefaultBaseValue = 10;
          const bool kFirstTimeCalling = false;
          Callback *null_callback = NULL;
          bool success = CalculateSomething(interesting_value,
                                            kDefaultBaseValue,
                                            kFirstTimeCalling,
                                            null_callback);
        </CODE_SNIPPET>
      </SUBSECTION>

<!--      <SUBSECTION title="Don'ts">-->
      <SUBSECTION title="してはいけないこと">
        <p>
<!--
          Note that you should <em>never</em> describe the code
          itself. Assume that the person reading the code knows C++
          better than you do, even though he or she does not know what
          you are trying to do:
-->
          コードそのものを説明しては<em>いけない</em>。たとえあなたが何をやろうとしているのか知らなくても、あなたよりC++のことをよく知っている人がコードを読んでいるのだと考えよう。
        </p>
        <BAD_CODE_SNIPPET>
           // Now go through the b array and make sure that if i occurs,
           // the next element is i+1.
           ...        // Geez.  What a useless comment.
        </BAD_CODE_SNIPPET>
      </SUBSECTION>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Punctuation, Spelling and Grammar">-->
  <STYLEPOINT title="句読点、綴り、文法">
    <SUMMARY>
<!--
      Pay attention to punctuation, spelling, and grammar; it is
      easier to read well-written comments than badly written ones.
-->
      句読点、綴り、文法に注意しよう。達筆なコメントの方が読みやすい。
    </SUMMARY>
    <BODY>
      <p>
<!--
        Comments should usually be written as complete
        sentences with proper capitalization and periods at the end.
        Shorter comments, such as comments at the end of a line of
        code, can sometimes be less formal, but you should be
        consistent with your style.  Complete sentences are more
        readable, and they provide some assurance that the comment is
        complete and not an unfinished thought.
-->
        コメントは通常、1つの完結した文章として書くべきだ。適切に大文字を使い、末尾にはピリオドを付けること。コードの末尾に入れるときのように、コメントが短くなるほど形式が失われることがある。でもスタイルには一貫性を持つべきだ。完結した文章の方が読みやすいし、完成したコメントは未完成の思い付きでないことをある程度保障してくれる。
      </p>
      <p>
<!--
        Although it can be frustrating to have a code reviewer point
        out that you are using a comma when you should be using a
        semicolon, it is very important that source code maintain a
        high level of clarity and readability.  Proper punctuation,
        spelling, and grammar help with that goal.
-->
        コードレビュアーから、セミコロンを使うべきなのにカンマを使っている、と指摘されるとイライラするが、ソースコードの明確さ、読みやすさを高いレベルで維持することは極めて重要だ。句読点や綴り、文法が適切であることは、それを実現する助けになる。
      </p>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="TODO Comments">-->
  <STYLEPOINT title="TODO コメント">
    <SUMMARY>
<!--
      Use <code>TODO</code> comments for code that is temporary, a
      short-term solution, or good-enough but not perfect.
-->
      <code>TODO</code> コメントは、一時的なものや、短期的な解決策、その場しのぎの不完全なところに使う。
    </SUMMARY>
    <BODY>
      <p>
<!--
        <code>TODO</code>s should include the string <code>TODO</code> in
        all caps, followed by your
        
        name, e-mail address, or other
        identifier
        in parentheses.  A colon is optional.  The main purpose is to have
        a consistent <code>TODO</code> format searchable by the person
        adding the comment (who can provide more details upon request).  A
        <code>TODO</code> is not a commitment to provide the fix yourself.
-->
        <code>TODO</code> には、すべて大文字からなる <code>TODO</code> という単語を使い、その後に名前やメールアドレスといった識別子を括弧で囲んだものを入れておくべきだ。コロンはあってもなくてもよい。これは <code>TODO</code> の書式に一貫性を持たせて、そのコメントを追加した人を探せるようにするためだ（その人に頼めばさらに詳細を教えてもらえる）。<code>TODO</code> は書いた人が自分で修正することを約束するものではない。
      </p>
      
      <CODE_SNIPPET>
        // TODO(kl@gmail.com): Use a "*" here for concatenation operator.
        // TODO(Zeke) change this to use relations.
      </CODE_SNIPPET>
      <p>
<!--
        If your <code>TODO</code> is of the form "At a future date do
        something" make sure that you either include a very specific
        date ("Fix by November 2005") or a very specific event
        ("Remove this code when all clients can handle XML responses.").
-->
        もし <code>TODO</code> が「将来の日付に何かする」という形式であれば、具体的な日付が入っているか（「2005年11月までに修正」）、もしくは具体的なイベントが入っているか（「すべてのクライアントがXMLレスポンスを処理できるようになったらこのコードを削除すること」）を確認しよう。
      </p>
    </BODY>
  </STYLEPOINT>

</CATEGORY>

<!--<CATEGORY title="Formatting">-->
<CATEGORY title="書式">
  <p>
<!--
    Coding style and formatting are pretty arbitrary, but a
    
    project
    is much easier to follow if everyone uses the same style. Individuals
    may not agree with every aspect of the formatting rules, and some of
    the rules may take some getting used to, but it is important that all
    
    project contributors
    follow the style rules so that
    
    they
    can all read and understand everyone's code easily.
-->
    コーディングスタイルや書式というものはかなりいい加減なものだが、みんなが同じスタイルを使うとプロジェクトはわかりやすくなる。書式のルールのすべてには合意してくれない人もいるだろう。慣れるまで時間がかかるルールもあるだろう。それでも、プロジェクトのコントリビュータ全員がスタイルルールに従うことは重要なことだ。こうすることで、全員のコードは読みやすく理解しやすいものになる。
  </p>
  
  <p>
<!--
    To help you format code correctly, we've created a <A HREF="http://google-styleguide.googlecode.com/svn/trunk/google-c-style.el">settings
    file for emacs</A>.
-->
    コードを正しい書式にするのを助けるために、私たちは <A HREF="http://google-styleguide.googlecode.com/svn/trunk/google-c-style.el">Emacs用の設定ファイル</A> を作った。
  </p>

<!--  <STYLEPOINT title="Line Length">-->
  <STYLEPOINT title="行の長さ">
    <SUMMARY>
<!--
      Each line of text in your code should be at most 80 characters
      long.
-->
      コードにおいて、テキスト1行の長さは、長くても80文字にすべきだ。
    </SUMMARY>
    <BODY>
      
      <p>
<!--
        We recognize that this rule is controversial, but so much existing
        code already adheres to it, and we feel that consistency is
        important.
-->
        このルールには賛否両論あると思うが、すでに既存のコードのほとんどがこれを守っているし、私たちは一貫性が重要だと思っている。
      </p>
      <PROS>
<!--
          Those who favor
          
          this rule argue
          that it is rude to force them to resize their windows and there
          is no need for anything longer.  Some folks are used to having
          several code windows side-by-side, and thus don't have room to
          widen their windows in any case.  People set up their work
          environment assuming a particular maximum window width, and 80
          columns has been the traditional standard.  Why change it?
-->
          このルールに賛成している人は、ウィンドウをリサイズさせるのは失礼なことで、これ以上長くする必要はないと言う。コーディングのために複数のウィンドウを並べて使って、これ以上ウィンドウを広げる余地がないという人もいる。みんな最大ウィンドウサイズを想定した作業環境を設定している。80カラムが昔からの標準だ。どうしてこれを変える必要があるんだい？
      </PROS>
      <CONS>
<!--
          Proponents of change argue that a wider line can make code
          more readable.  The 80-column limit is an hidebound
          throwback to 1960s mainframes;
          
          modern equipment has
          wide screens that can easily show longer lines.
-->
          変更を支持している人は、1行を長くするとコードがもっと読みやすくなると言う。80カラムという制限は時代遅れで、1960年代のメインフレームに後戻りするようなものだ。最新機器はもっとスクリーンが広くて、簡単にもっと長い行を表示することができる。
      </CONS>
      <DECISION>
        <p>
<!--          
          80 characters is the maximum.
-->
          80文字を最大とする。
        </p>
        <p>
<!--
          Exception: if a comment line contains an example command or
          a literal URL longer than 80 characters, that line may be
          longer than 80 characters for ease of cut and paste.
-->
          例外: もしコメント行に80文字を超えるコマンド例やURL文字列が含まれるのなら、カット・アンド・ペーストが簡単にできるよう、その行は80文字を超えても構わない。
        </p>
        <p>
<!--
          Exception: an <code>#include</code> statement with a long
          path may exceed 80 columns.  Try to avoid situations where this
          becomes necessary.
-->
          例外: 80カラムを超える長いパスを含む <code>#include</code> 文。こんなものが必要にならないようにしよう。
        </p>
        <p>
<!--
          Exception:  you needn't be concerned about
          <a href="#The__define_Guard">header guards</a>
          that exceed the maximum length.
-->
          例外: <a href="#The__define_Guard">ヘッダガード</a>は最大長を超えても気にする必要はない。
        </p>
      </DECISION>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Non-ASCII Characters">-->
  <STYLEPOINT title="非ASCII文字">
    <SUMMARY>
<!--
      Non-ASCII characters should be rare, and must use UTF-8 formatting.
-->
      非ASCII文字はめったに使ってはいけない。もし使うときには UTF-8フォーマットを使わなければならない。
    </SUMMARY>
    <BODY>
      <p>
<!--
        You shouldn't hard-code user-facing text in source, even English,
        so use of non-ASCII characters should be rare.  However, in certain
        cases it is appropriate to include such words in your code.  For
        example, if your code parses data files from foreign
        
        
        it may be appropriate to hard-code the non-ASCII string(s) used in
        those data files as delimiters.  More commonly, unittest code
        (which does not
        
        need to be localized) might contain non-ASCII strings.  In such
        cases, you should use UTF-8, since that is
        
        an encoding understood by most tools able
        to handle more than just ASCII.
        Hex encoding is also OK, and encouraged where it enhances
        readability &#8212; for example, <code>"\xEF\xBB\xBF"</code> is the
        Unicode zero-width no-break space character, which would be
        invisible if included in the source as straight UTF-8.
-->
        ユーザに見せるテキストをソースにハードコードしてはいけない。たとえ英語だとしてもだ。そのため、非ASCII文字を使うことはほとんどないはずだ。そういったテキストをコードに入れる方がよい場合もある。例えば、外部からのデータファイルをパースするコードであれば、データファイルのデリミタとして使う非ASCII文字をハードコードしておく方がよいかもしれない。もっとよくあるのは、ユニットテストのコード（ローカライズの必要はない）に特定の非ASCII文字が含まれている場合だ。このときには UTF-8 を使うべきだ。UTF-8であれば、ASCII以外の文字を処理できるたいていのツールで解釈可能だ。
        Hexエンコーディングを使っても構わない。これを使うと読みやすくなることがある。例えば、<code>"\xEF\xBB\xBF"</code> は Unicode の ゼロ幅改行なし空白文字であり、ソースコードにそのままUTF-8として入れても見ることができない。
      </p>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Spaces vs. Tabs">-->
  <STYLEPOINT title="スペース 対 タブ">
    <SUMMARY>
<!--
      Use only spaces, and indent 2 spaces at a time.
-->
      スペースだけを使う。インデントはスペース2つにする。
    </SUMMARY>
    <BODY>
      <p>
<!--
        We use spaces for indentation. Do not use tabs in your code.
        You should set your editor to emit spaces when you hit the tab
        key.
-->
        インデントにはスペースを使う。コードにはタブを使ってはいけない。
        タブキーを押したときにはスペースが入力されるように、エディタを設定しておこう。
      </p>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Function Declarations and Definitions">-->
  <STYLEPOINT title="関数の宣言と定義">
    <SUMMARY>
<!--
      Return type on the same line as function name, parameters on the
      same line if they fit.
-->
      戻り値の型は関数名と同じ行に書く。1行に収まるなら、パラメータも同じ行に書く。
    </SUMMARY>
    <BODY>
      <p>
<!--
        Functions look like this:
-->
        関数は次のようになる:
      </p>
      <CODE_SNIPPET>
        ReturnType ClassName::FunctionName(Type par_name1, Type par_name2) {
          DoSomething();
          ...
        }
      </CODE_SNIPPET>
      <p>
<!--
        If you have too much text to fit on one line:
-->
        長すぎて1行に収まらないときには、次のようにする:
      </p>
      <CODE_SNIPPET>
        ReturnType ClassName::ReallyLongFunctionName(Type par_name1,
                                                     Type par_name2,
                                                     Type par_name3) {
          DoSomething();
          ...
        }
      </CODE_SNIPPET>
      <p>
<!--
        or if you cannot fit even the first parameter:
-->
        最初のパラメータでさえも1行に収まらないのであれば、次のようにする:
      </p>
      <CODE_SNIPPET>
        ReturnType LongClassName::ReallyReallyReallyLongFunctionName(
            Type par_name1,  // スペース4つでインデント
            Type par_name2,
            Type par_name3) {
          DoSomething();  // スペース2つでインデント
          ...
        }
      </CODE_SNIPPET>
      <p>
<!--
        Some points to note:
-->
        注意すべきポイント:
      </p>
      <ul>
<!--
        <li> The return type is always on the same line as the
             function name.
-->
        <li> 戻り値の型はいつも関数名と同じ行に書くこと。
             </li>
<!--
        <li> The open parenthesis is always on the same line as the
             function name.
-->
        <li> 開き括弧（'('）はいつも関数名と同じ行に書くこと。
             </li>
<!--
        <li> There is never a space between the function name and the
             open parenthesis.
-->
        <li> 関数名と開き括弧の間にはスペースを入れてはいけない。
             </li>
<!--
        <li> There is never a space between the parentheses and the
             parameters.
-->
        <li> 括弧とパラメータの間にはスペースを入れてはいけない。
             </li>
<!--
        <li> The open curly brace is always at the end of the same
             line as the last parameter.
-->
        <li> 開き中括弧（'{'）は必ず最後のパラメータと同じ行の末尾に書くこと。
             </li>
<!--
        <li> The close curly brace is either on the last line by itself
             or (if other style rules permit) on the same line as the
             open curly brace.
-->
        <li> 閉じ中括弧（'}'）はそのブロックの最後の行か、(もし別のスタイルルールが許しているなら)開き中括弧（'}'）と同じ行に書くこと。
             </li>
<!--
        <li> There should be a space between the close parenthesis and
             the open curly brace.
-->
        <li> 閉じ括弧（')'）と開き中括弧（'{'）の間にはスペースを入れるべきではない。
             </li>
<!--
        <li> All parameters should be named, with identical names in the
             declaration and implementation.
-->
        <li> パラメータにはすべて、宣言や実装と同じ名前を付けておくべきだ。
             </li>
<!--
        <li> All parameters should be aligned if possible.
-->
        <li> パラメータはすべて、できるだけ整列させるべきだ。
             </li>
<!--
        <li> Default indentation is 2 spaces.
-->
        <li> デフォルトのインデントはスペース2つにする。
             </li>
<!--
        <li> Wrapped parameters have a 4 space indent.
             </li>
-->
        <li> ラップしたパラメータはスペース4つでインデントする。</li>
      </ul>
      <p>
<!--
        If your function is <code>const</code>, the <code>const</code>
        keyword should be on the same line as the last parameter:
-->
        もし関数が <code>const</code> であれば、<code>const</code> キーワードは最後のパラメータと同じ行に書くべきだ:
      </p>
      <CODE_SNIPPET>
        // この関数シグニチャはすべて1行に収まっている。
        ReturnType FunctionName(Type par) const {
          ...
        }

        // この関数シグニチャには複数行必要になるが、
        // const キーワードは最後のパラメータと同じ行に書いている。
        ReturnType ReallyLongFunctionName(Type par1,
                                          Type par2) const {
          ...
        }
      </CODE_SNIPPET>
      <p>
<!--
        If some parameters are unused, comment out the variable name in the
        function definition:
-->
        もし使われていないパラメータがあれば、関数の定義にある変数名をコメントアウトしておく: 
      </p>
      <CODE_SNIPPET>
        // インタフェースにおけるパラメータには必ず名前を付ける。
        class Shape {
         public:
          virtual void Rotate(double radians) = 0;
        }

        // 宣言におけるパラメータには必ず名前を付ける。
        class Circle : public Shape {
         public:
          virtual void Rotate(double radians);
        }

        // 定義されているが使っていないパラメータの名前はコメントアウトしておく。
        void Circle::Rotate(double /*radians*/) {}
      </CODE_SNIPPET>
      <BAD_CODE_SNIPPET>
        // よくない - 後で誰かが実装しようとしたとき、変数が何を意味しているかわからない。
        void Circle::Rotate(double) {}
      </BAD_CODE_SNIPPET>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Function Calls">-->
  <STYLEPOINT title="関数呼び出し">
    <SUMMARY>
<!--
      On one line if it fits; otherwise, wrap arguments at the
      parenthesis.
-->
      可能であれば1行に収める。収まらなければ、括弧で引数をくるむ。
    </SUMMARY>
    <BODY>
      <p>
<!--
        Function calls have the following format:
-->
        関数呼び出しは次のような書式にする:
      </p>
      <CODE_SNIPPET>
        bool retval = DoSomething(argument1, argument2, argument3);
      </CODE_SNIPPET>
      <p>
<!--
        If the arguments do not all fit on one line, they should be
        broken up onto multiple lines, with each subsequent line
        aligned with the first argument.  Do not add spaces after the
        open paren or before the close paren:
-->
        もし引数が1行に収まらなければ複数の行に分割して、以降の行は最初の引数で整列させるべきだ。開き括弧の後や閉じ括弧の前にスペースを入れてはいけない:
      </p>
      <CODE_SNIPPET>
        bool retval = DoSomething(averyveryveryverylongargument1,
                                  argument2, argument3);
      </CODE_SNIPPET>
      <p>
<!--
        If the function has many arguments, consider having one per
        line if this makes the code more readable:
-->
        関数に引数がたくさんあるときには、コードが読みやすくなるなら、1行につき引数を1つ書くことを検討する:
      </p>
      <CODE_SNIPPET>
        bool retval = DoSomething(argument1,
                                  argument2,
                                  argument3,
                                  argument4);
      </CODE_SNIPPET>
      <p>
<!--
        If the function signature is so long that it cannot fit within
        the maximum <a href="#Line_Length">line length</a>, you may
        place all arguments on subsequent lines:
-->
        関数シグニチャが長すぎて最大の<a href="#Line_Length">行の長さ</a>に収まらないときには、すべての引数を次の行以降に書いても構わない:
      </p>
      <CODE_SNIPPET>
        if (...) {
          ...
          ...
          if (...) {
            DoSomethingThatRequiresALongFunctionName(
                very_long_argument1,  // スペース4つでインデント
                argument2,
                argument3,
                argument4);
          }
      </CODE_SNIPPET>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Conditionals">-->
  <STYLEPOINT title="条件文">
    <SUMMARY>
<!--
      Prefer no spaces inside parentheses.  The <code>else</code>
      keyword belongs on a new line.
-->
      括弧の中にはスペースを入れない方が望ましい。<code>else</code> キーワードは新しい行にする。
    </SUMMARY>
    <BODY>
      <p>
<!--
        There are two acceptable formats for a basic conditional
        statement. One includes spaces between the parentheses and the
        condition, and one does not.
-->
        基本的な条件文には2つの書式が許されている。1つは括弧と条件との間にスペースを入れるもので、もう1つは入れないものだ。
      </p>
      <p>
<!--
        The most common form is without spaces.  Either is fine, but
        <em>be consistent</em>. If you are modifying a file, use the
        format that is already present. If you are writing new code,
        use the format that the other files in that directory or
        project use. If in doubt and you have no personal preference,
        do not add the spaces.
-->
        よく見かけるのはスペースが入っていない書式だ。どちらでもいいのだが、<em>一貫性</em>を持たせること。もし既存のファイルを変更しているのであれば、そこで使われている書式を使うこと。もし新しくコードを書いているのであれば、そのディレクトリやプロジェクトで使われている他のファイルの書式を使うこと。よくわからなくて個人的な好みがないのであれば、スペースを入れないでおこう。
      </p>
      <CODE_SNIPPET>
        if (condition) {  // no spaces inside parentheses
          ...  // スペース2つでインデント。
        } else {  // else は閉じ中括弧と同じ行に続ける。
          ...
        }
      </CODE_SNIPPET>
      <p>
<!--
        If you prefer you may add spaces inside the
        parentheses:
-->
        好みで括弧の中にスペースを入れても構わない:
      </p>
      <CODE_SNIPPET>
        if ( condition ) {  // 括弧の中にスペースを入れる - めったにない
          ...  // スペース2つでインデント。
        } else {  // else は閉じ中括弧と同じ行に続ける。
          ...
        }
      </CODE_SNIPPET>
      <p>
<!--
        Note that in all cases you must have a space between the
        <code>if</code> and the open parenthesis.  You must also have
        a space between the close parenthesis and the curly brace, if
        you're using one.
-->
        <code>if</code> と開き括弧との間には必ずスペースを1つ入れなければならないことに注意すること。中括弧を使うときには閉じ括弧と中括弧との間にもスペースを1つ入れなければならない。
      </p>
      <BAD_CODE_SNIPPET>
        if(condition)     // よくない - IF の後にスペースを入れていない。
        if (condition){   // よくない - { の前にスペースを入れていない。
        if(condition){    // 2重によくない。
      </BAD_CODE_SNIPPET>
      <CODE_SNIPPET>
        if (condition) {  // よい - IF の後も { の前にも正しくスペースを入れている。
      </CODE_SNIPPET>
      <p>
<!--
        Short conditional statements may be written on one line if
        this enhances readability.  You may use this only when the
        line is brief and the statement does not use the
        <code>else</code> clause.
-->
        もしその方が読みやすければ、短い条件文を1行に書いても構わない。この行が簡潔であって、文に <code>else</code> 節がないときにだけこれが許される。
      </p>
      <CODE_SNIPPET>
        if (x == kFoo) return new Foo();
        if (x == kBar) return new Bar();
      </CODE_SNIPPET>
      <p>
<!--
        This is not allowed if the if statement has an
        <code>else</code>:
-->
        if文に <code>else</code> があるときには、これは許されない:
      </p>
      <BAD_CODE_SNIPPET>
        // 許されない - ELSE節があるときには、IF文を1行に書くこと
        if (x) DoThis();
        else DoThat();
      </BAD_CODE_SNIPPET>
      <p>
<!--
        In general, curly braces are not required for single-line
        statements, but they are allowed if you like them;
        conditional or loop statements with complex conditions or
        statements may be more readable with curly braces. Some

        projects
        require that an <CODE>if</CODE> must always always have an
        accompanying brace.
-->
        一般に、1行だけの文に中括弧を付ける必要はないが、中括弧を使うのが好みであればそうしても構わない。複雑な条件や文を含む条件文やループ文の場合、中括弧を使った方が読みやすいかもしれない。<CODE>if</CODE> には必ず中括弧を付けなければならない、としているプロジェクトもある。
      </p>
      <CODE_SNIPPET>
        if (condition)
          DoSomething();  // スペース2つでインデント。

        if (condition) {
          DoSomething();  // スペース2つでインデント。
        }
      </CODE_SNIPPET>
      <p>
<!--
        However, if one part of an <code>if</code>-<code>else</code>
        statement uses curly braces, the other part must too:
-->
        しかし、同じ<code>if</code>-<code>else</code>文のなかで中括弧を使っているところがあれば、他のところでも中括弧を使わなければならない。
      </p>
      <BAD_CODE_SNIPPET>
        // 許されない - IF には中括弧があるが ELSE には中括弧がない
        if (condition) {
          foo;
        } else
          bar;

        // 許されない - ELSE には中括弧があるが IF には中括弧がない
        if (condition)
          foo;
        else {
          bar;
        }
      </BAD_CODE_SNIPPET>
      <CODE_SNIPPET>
        // IF/ELSE節の1つに中括弧が使われているため、
        // IF と ELSE の両方に中括弧が必要になる。
        if (condition) {
          foo;
        } else {
          bar;
        }
      </CODE_SNIPPET>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Loops and Switch Statements">-->
  <STYLEPOINT title="ループとスイッチ文">
    <SUMMARY>
<!--
      Switch statements may use braces for blocks.  Empty loop bodies should use
      <code>{}</code> or <code>continue</code>.
-->
      スイッチ文のブロックには中括弧を使っても構わない。空ループの本体には、<code>{}</code> か <code>continue</code> を使うべきだ。
    </SUMMARY>
    <BODY>
      <p>
<!--
        <code>case</code> blocks in <code>switch</code> statements can have
        curly braces or not, depending on your preference.  If you do
        include curly braces they should be placed as shown below.
-->
        <code>switch</code> の <code>case</code> ブロックには中括弧を付けても付けなくてもよい。もし中括弧を付けるのであれば、以下のようにすべきだ。
      </p>
      <p>
<!--
        If not conditional on an enumerated value, switch statements
        should always have a <code>default</code> case (in the case of
        an enumerated value, the compiler will warn you if any values
        are not handled).  If the default case should never execute,
        simply
        <code>assert</code>:
-->
        もし条件が列挙値でなければ、switch文にはいつも<code>default</code> ケースを入れておくべきだ（列挙値の場合は、コンパイラが値が処理されないということを警告してくれる）。もしdefault ケースが実行されるべきでないときには、単に <code>assert</code> を書いておこう:
      </p>
      
      <CODE_SNIPPET>
        switch (var) {
          case 0: {  // スペース2つでインデント
            ...      // スペース4つでインデント
            break;
          }
          case 1: {
            ...
            break;
          }
          default: {
            assert(false);
          }
        }
      </CODE_SNIPPET>
      <p>
<!--
        Empty loop bodies should use <code>{}</code> or
        <code>continue</code>, but not a single semicolon.
-->
        空ループの本体には、<code>{}</code> や <code>continue</code> を使うべきだ。セミコロンだけにすべきではない。
      </p>
      <CODE_SNIPPET>
        while (condition) {
          // false が返ってくるまでテストを繰り返す。
        }
        for (int i = 0; i &lt; kSomeNumber; ++i) {}  // よい - 空の本体。
        while (condition) continue;  // よい - continue はロジックがないことを示している。
      </CODE_SNIPPET>
      <BAD_CODE_SNIPPET>
        while (condition);  // よくない - do/while ループの一部のように見える。
      </BAD_CODE_SNIPPET>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Pointer and Reference Expressions">-->
  <STYLEPOINT title="ポインタとリファレンス表現">
    <SUMMARY>
<!--
      No spaces around period or arrow.  Pointer operators do not have
      trailing spaces.
-->
      ピリオドや矢印のまわりにはスペースを入れない。ポインタ演算子には後ろにスペースを付けない。
    </SUMMARY>
    <BODY>
      <p>
<!--
        The following are examples of correctly-formatted pointer and
        reference expressions:
-->
        ポインタとリファレンス表現の正しい書式の例を挙げる:
      </p>
      <CODE_SNIPPET>
        x = *p;
        p = &amp;x;
        x = r.y;
        x = r-&gt;y;
      </CODE_SNIPPET>
      <p>
<!--
        Note that:
-->
        以下に注意すること:
      </p>
      <ul>
<!--
        <li> There are no spaces around the period or arrow when
             accessing a member.
-->
        <li> メンバにアクセスするときにはピリオドや矢印のまわりにスペースを入れないこと。
             </li>
<!--
        <li> Pointer operators have no space after the <code>*</code> or
             <code>&amp;</code>.
-->
        <li> ポインタ演算子には <code>*</code> や <code>&amp;</code> の後ろにスペースを入れないこと。
             </li>
      </ul>
      <p>
<!--
        When declaring a pointer variable or argument, you may place
        the asterisk adjacent to either the type or to the variable
        name:
-->
        ポインタ変数やポインタ引数を宣言するときには、アスタリスクを型の側に置いてもいいし変数名の側に置いてもよい:
      </p>
      <CODE_SNIPPET>
        // These are fine, space preceding.
        char *c;
        const string &amp;str;

        // These are fine, space following.
        char* c;    // but remember to do "char* c, *d, *e, ...;"!
        const string&amp; str;
      </CODE_SNIPPET>
      <BAD_CODE_SNIPPET>
        char * c;  // Bad - spaces on both sides of *
        const string &amp; str;  // Bad - spaces on both sides of &amp;
      </BAD_CODE_SNIPPET>
      <p>
<!--
        You should do this consistently within a single
        file,
        so, when modifying an existing file, use the style in that
        file.
-->
        ファイル内では一貫性を持たせるべきだ。既存のファイルを変更するときには、そのファイルのスタイルに従うこと。
      </p>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Boolean Expressions">-->
  <STYLEPOINT title="ブーリアン表現">
    <SUMMARY>
<!--
      When you have a boolean expression that is longer than the <a href="#Line_Length">standard line length</a>, be consistent in
      how you break up the lines.
-->
      <a href="#Line_Length">標準の行の長さ</a>よりも長いブーリアン表現を書くときには、行の分割方法に一貫性を持たせる。
    </SUMMARY>
    <BODY>
      <p>
<!--
        In this example, the logical AND operator is always at the end
        of the lines:
-->
        この例では、論理積オペレータを常に行末に置いている:
      </p>
      <CODE_SNIPPET>
        if (this_one_thing &gt; this_other_thing &amp;&amp;
            a_third_thing == a_fourth_thing &amp;&amp;
            yet_another &amp; last_one) {
          ...
        }
      </CODE_SNIPPET>
      <p>
<!--
        Note that both of the <code>&amp;&amp;</code> logical AND
        operators are the end of the line.  Feel free to insert extra
        parentheses judiciously, because they can be very helpful in
        increasing readability when used appropriately.
-->
        <code>&amp;&amp;</code> 論理積オペレータは両方とも行の末尾にあることに注意しよう。余分な括弧を入れても構わない。うまくやると非常に読みやすくなる。
      </p>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Return Values">-->
  <STYLEPOINT title="戻り値">
    <SUMMARY>
<!--
      Do not surround the <code>return</code> expression with parentheses.
-->
      <code>return</code> 式を括弧で囲んではいけない。
    </SUMMARY>
    <BODY>
      <p>
<!--
        Return values should not have parentheses:
-->
        戻り値は括弧で囲むべきではない。
      </p>
      <CODE_SNIPPET>
        return x;  // return(x); にしない
      </CODE_SNIPPET>
    </BODY>
  </STYLEPOINT>

  

<!--  <STYLEPOINT title="Variable and Array Initialization">-->
  <STYLEPOINT title="変数と配列の初期化">
    <SUMMARY>
<!--
      Your choice of <code>=</code> or <code>()</code>.
-->
      初期化に <code>=</code> を使うか <code>()</code> を使うかは、自由に選んでよい。
    </SUMMARY>
    <BODY>
      <p>
<!--
        You may choose between <code>=</code> and <code>()</code>; the
        following are all correct:
-->
        初期化に <code>=</code> を使うか <code>()</code> を使うかは、自由に選べばよい。以下はすべて正しい書き方になる:
      </p>
      <CODE_SNIPPET>
        int x = 3;
        int x(3);
        string name("Some Name");
        string name = "Some Name";
      </CODE_SNIPPET>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Preprocessor Directives">-->
  <STYLEPOINT title="プリプロセッサディレクティブ">
    <SUMMARY>
<!--
      Preprocessor directives should not be indented but should
      instead start at the beginning of the line.
-->
      プリプロセッサディレクティブはインデントすべきではない。行の先頭から開始するべきだ。
    </SUMMARY>
    <BODY>
      <p>
<!--
        Even when pre-processor directives are within the body of
        indented code, the directives should start at the beginning of
        the line.
-->
        プリプロセッサディレクティブがインデントされたコードの本体の中にあるときでも、ディレクティブは行の先頭から始めるべきだ。
      </p>
      <CODE_SNIPPET>
        // よい - ディレクティブが行の先頭にある。
          if (lopsided_score) {
        #if DISASTER_PENDING      // 正しい -- 行の先頭から始まっている。
            DropEverything();
        #endif
            BackToNormal();
          }
      </CODE_SNIPPET>
      <BAD_CODE_SNIPPET>
        // よくない - ディレクティブをインデントしている
          if (lopsided_score) {
            #if DISASTER_PENDING  // 間違い!  "#if" は行の先頭にあるべき。
            DropEverything();
            #endif                // 間違い!  "#endif" をインデントしてはいけない。
            BackToNormal();
          }
      </BAD_CODE_SNIPPET>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Class Format">-->
  <STYLEPOINT title="クラスの書式">
    <SUMMARY>
<!--
      Sections in <code>public</code>, <code>protected</code> and
      <code>private</code> order, each indented one space.
-->
      <code>public</code>、<code>protected</code>、<code>private</code> の各セクションはこの順序で書く。スペース1つでインデントすること。
    </SUMMARY>
    <BODY>
      <p>
<!--
        The basic format for a class declaration (lacking the
        comments, see <a HREF="#Class_Comments">Class Comments</a> for
        a discussion of what comments are needed) is:
-->
        クラス定義の基本となる書式は次のようになる（ここにはコメントを入れていないが、どんなコメントが必要かについては、<a HREF="#Class_Comments">クラスのコメント</a>を参照すること）:
      </p>
      <CODE_SNIPPET>
        class MyClass : public OtherClass {
         public:      // スペース1つでインデントしていることに注意!
          MyClass();  // 通常のスペース2つでインデント。
          explicit MyClass(int var);
          ~MyClass() {}

          void SomeFunction();
          void SomeFunctionThatDoesNothing() {
          }

          void set_some_var(int var) { some_var_ = var; }
          int some_var() const { return some_var_; }

         private:
          bool SomeInternalFunction();

          int some_var_;
          int some_other_var_;
          DISALLOW_COPY_AND_ASSIGN(MyClass);
        };
      </CODE_SNIPPET>
      <p>
<!--
        Things to note:
-->
        注意すべきこと:
      </p>
      <ul>
<!--
        <li> Any base class name should be on the same line as the
             subclass name, subject to the 80-column limit.
-->
        <li> ベースクラス名はサブクラス名と同じ行に書くべきだ。80カラムの制限を受ける。
             </li>
<!--
        <li> The <code>public:</code>, <code>protected:</code>, and
             <code>private:</code> keywords should be indented one
             space.
-->
        <li> <code>public:</code>、<code>protected:</code>、<code>private:</code> キーワードはスペース1つでインデントするべきだ。
             </li>
<!--
        <li> Except for the first instance, these keywords should be preceded
             by a blank line. This rule is optional in small classes.
-->
        <li> 最初の例を除いて、こうしたキーワードの前には空行を入れておくべきだ。このルールは小さいクラスの場合にはオプションだ。
             </li>
<!--
        <li> Do not leave a blank line after these keywords.
-->
        <li> これらのキーワードの後に空行を入れてはいけない。
             </li>
<!--
        <li> The <code>public</code> section should be first, followed by
             the <code>protected</code> and finally the
             <code>private</code> section.
-->
        <li> <code>public</code> セクションがまず最初にきて、その後に <code>protected</code>、それから最後に <code>private</code> セクションがくるようにするべきだ。
             </li>
<!--
        <li> See <a HREF="#Declaration_Order">Declaration Order</a> for
             rules on ordering declarations within each of these sections.
-->
        <li> セクション内の宣言の順序に関するルールについては、<a HREF="#Declaration_Order">宣言の順序</a>を参照すること。
             </li>
      </ul>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Initializer Lists">-->
  <STYLEPOINT title="イニシャライザリスト">
    <SUMMARY>
<!--
      Constructor initializer lists can be all on one line or with
      subsequent lines indented four spaces.
-->
      コンストラクタのイニシャライザリストはすべて1行に書くか、もしくは以降の行にスペース4つでインデントして書いてもよい。
    </SUMMARY>
    <BODY>
      <p>
<!--
        There are two acceptable formats for initializer lists:
-->
        イニシャライザリストには2つの書式が許されている。
      </p>
      <CODE_SNIPPET>
        // すべて1行に収まるとき:
        MyClass::MyClass(int var) : some_var_(var), some_other_var_(var + 1) {}
      </CODE_SNIPPET>
      <p>
<!--
        or
-->
        または
      </p>
      <CODE_SNIPPET>
        // 複数行が必要なときはスペース4つでインデントして、
        // イニシャライザの最初の行にコロンを入れる
        MyClass::MyClass(int var)
            : some_var_(var),             // スペース4つでインデント
              some_other_var_(var + 1) {  // 一列に並べる
          ...
          DoSomething();
          ...
        }
      </CODE_SNIPPET>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Namespace Formatting">-->
  <STYLEPOINT title="名前空間の書式">
    <SUMMARY>
<!--
      The contents of namespaces are not indented.
-->
      名前空間の内容はインデントしない。
    </SUMMARY>
    <BODY>
      <p>
<!--
        <a href="#Namespaces">Namespaces</a> do not add an extra level of
        indentation. For example, use:
-->
        <a href="#Namespaces">名前空間</a>には余分なインデントをしないこと。例えば次のようにすること:
      </p>
      <CODE_SNIPPET>
        namespace {

        void foo() {  // 正しい。名前空間内では余分なインデントをしない。
          ...
        }

        }  // namespace
      </CODE_SNIPPET>
      <p>
<!--
        Do not indent within a namespace:
-->
        名前空間内はインデントしてはいけない:
      </p>
      <BAD_CODE_SNIPPET>
        namespace {

          // 間違い。すべきではないインデント。
          void foo() {
            ...
          }

        }  // namespace
      </BAD_CODE_SNIPPET>
    </BODY>
  </STYLEPOINT>

<!--  <STYLEPOINT title="Horizontal Whitespace">-->
  <STYLEPOINT title="水平方向の空白">
    <SUMMARY>
<!--
      Use of horizontal whitespace depends on location.  Never put trailing
      whitespace at the end of a line.
-->
      水平方向の空白を使うかは場所によって異なる。行末には空白を入れてはいけない。
    </SUMMARY>
    <BODY>
      <SUBSECTION title="一般">
        <CODE_SNIPPET>
        void f(bool b) {  // 開き中括弧の前には必ずスペースを1つ入れるべきだ。
          ...
        int i = 0;  // セミコロンの前には通常、スペースを入れない。
        int x[] = { 0 };  // 配列の初期化のための中括弧にスペースを入れるのはオプションだ。
        int x[] = {0};    // もし入れるのであれば、両側に入れること!
        // 継承とイニシャライザリストのコロンのまわりにはスペースを1つ入れる。
        class Foo : public Bar {
         public:
          // インライン関数の実装には、中括弧とその実装自体との間にはスペースを1つ入れる。
          Foo(int b) : Bar(), baz_(b) {}  // 空の中括弧のなかにはスペースを入れない。
          void Reset() { baz_ = 0; }  // 実装と中括弧のあいだにはスペースを1つ入れる。
          ...
        </CODE_SNIPPET>
        <p>
<!--
          Adding trailing whitespace can cause extra work for others editing
          the same file, when they merge, as can removing existing trailing
          whitespace.  So:  Don't introduce trailing whitespace.  Remove it
          if you're already changing that line, or do it in a separate
          clean-up
          
          operation (preferably when no-one else
          is working on the file).
-->
          末尾に空白が入っていると、もともとあった末尾の空白を削除して、他の人が同じファイルを編集してマージしようとしたときに余計な作業が発生することがある。だから、末尾に空白を入れてはいけない。もしちょうど末尾に空白のある行を変更しているのなら空白を削除しよう。あるいは、別のクリーンナップ操作の中でそうしよう（できれば誰もそのファイルで作業をしていないときに）。
        </p>
      </SUBSECTION>
<!--      <SUBSECTION title="Loops and Conditionals">-->
      <SUBSECTION title="ループと条件">
        <CODE_SNIPPET>
        if (b) {          // 条件とループのキーワードの後のスペース。
        } else {          // else のまわりにはスペースを入れる。
        }
        while (test) {}   // 括弧のなかには通常スペースを入れない。
        switch (i) {
        for (int i = 0; i &lt; 5; ++i) {
        switch ( i ) {    // ループと条件では、括弧のなかにスペースを入れても構わないが、
        if ( test ) {     // こうするのはまれだ。一貫性を持たせること。
        for ( int i = 0; i &lt; 5; ++i ) {
        for ( ; i &lt; 5 ; ++i) {  // ループでは、セミコロンの後に必ずスペースを1つ入れる。
          ...                   // セミコロンの前にもスペースを1つ入れても構わない。
        switch (i) {
          case 1:         // switch 文の case のコロンの前にはスペースを入れない。
            ...
          case 2: break;  // コロンの後にコードを書くなら、コロンの後にスペースを1つ入れる。
        </CODE_SNIPPET>
      </SUBSECTION>
<!--      <SUBSECTION title="Operators">-->
      <SUBSECTION title="オペレータ">
        <CODE_SNIPPET>
        x = 0;              // 代入オペレータのまわりには必ずスペースを入れる。
        x = -5;             // 単項オペレータとその引数のまわりにはスペースを入れない。
        ++x;                
        if (x &amp;&amp; !y)
          ...
        v = w * x + y / z;  // 2項オペレータのまわりには通常スペースを入れるが、
        v = w*x + y/z;      // 倍数のまわりのスペースは削除しても構わない。
        v = w * (x + z);    // 括弧のなかにはスペースを入れるべきではない。
        </CODE_SNIPPET>
      </SUBSECTION>
<!--      <SUBSECTION title="Templates and Casts">-->
      <SUBSECTION title="テンプレートとキャスト">
        <CODE_SNIPPET>
        vector&lt;string&gt; x;           // 山括弧（&lt; と &gt;）のなか、&lt; の前、もしくは、
        y = static_cast&lt;char*&gt;(x);  // キャストにおける &gt; と ( の間にはスペースを入れない。
        vector&lt;char *&gt; x;           // 型とポインタの間にはスペースを入れても構わないが、
                                    // 一貫性を持たせること。
        set&lt;list&lt;string&gt; &gt; x;       // C++ では &gt; と &gt; の間にスペースが1つ必要になる。
        set&lt; list&lt;string&gt; &gt; x;      // オプションで、&lt; と &lt; の間に対称となるようスペースを
                                    // 入れても構わない。
        </CODE_SNIPPET>
      </SUBSECTION>
    </BODY>
  </STYLEPOINT>


<!--  <STYLEPOINT title="Vertical Whitespace">-->
  <STYLEPOINT title="垂直方向の空白">
    <SUMMARY>
<!--
      Minimize use of vertical whitespace.
-->
      垂直方向の空白は最小限にする。
    </SUMMARY>
    <BODY>
      <p>
<!--
        This is more a principle than a rule: don't use blank lines
        when you don't have to.  In particular, don't put more than
        one or two blank lines between functions, don't start or end
        functions with a blank line, and be discriminating with your
        use of blank lines inside functions.
-->
        これはルールというよりも原則だ。必要のない空行を入れてはいけない。具体的に言うと、関数と関数の間に1、2行以上の空行を入れてはいけない。関数を空行で始めてはいけないし、空行で終わってはいけない。関数内で空行を使うときには厳選すること。
      </p>
      <p>
<!--
        The basic principle is: The more code that fits on one screen,
        the easier it is to follow and understand the control flow of
        the program.  Of course, readability can suffer from code
        being too dense as well as too spread out, so use your
        judgement.  But in general, minimize use of vertical
        whitespace.
-->
        基本原則: コードが1画面にうまく収まれば収まるほど、プログラムの制御フローは追いやすく理解しやすくなる。言うまでもないことだが、コードが密集しすぎても広がりすぎても、読みやすくはならない。自分で判断しよう。しかし一般的には、垂直方向の空白の使用は最小限にすること。
      </p>
      <p>
<!--
        Don't start or end functions with blank lines:
-->
        関数を空行で始めてはいけないし、空行で終わってもいけない:
        <BAD_CODE_SNIPPET>
          void Function() {

            // 前後に不必要な空行がある

          }
        </BAD_CODE_SNIPPET>
      </p>
      <p>
<!--
        Don't start and end blocks with blank lines either:
-->
        ブロックを空行で始めてはいけないし、空行で終わってもいけない:
        <BAD_CODE_SNIPPET>
          while (condition) {
            // 後ろに不必要な空行がある

          }
          if (condition) {

            // 前に不必要な空行がある
          }
        </BAD_CODE_SNIPPET>
<!--
        However, it's okay to add blank lines between a chain of
        if-else blocks:
-->
        ただし、if-else ブロックの間には空行を入れても構わない。
        <CODE_SNIPPET>
        if (condition) {
          // 別の機能に移るにはあまりにコードが少ないので、
          // 空行を入れておく。

        } else {
          // 別のコードブロック
        }
        </CODE_SNIPPET>
      </p>
    </BODY>
  </STYLEPOINT>
</CATEGORY>

<!--<CATEGORY title="Exceptions to the Rules">-->
<CATEGORY title="ルールの例外">
  <p>
<!--
    The coding conventions described above are mandatory.  However,
    like all good rules, these sometimes have exceptions, which we
    discuss here.
-->
    ここに記載したコーディング規約は必須のものだ。しかし、どんな優れたルールにも、時には例外がある。ここで説明しよう。
  </p>

  

<!--  <STYLEPOINT title="Existing Non-conformant Code">-->
  <STYLEPOINT title="ルールに従っていない既存のコード">
    <SUMMARY>
<!--
      You may diverge from the rules when dealing with code that does not
      conform to this style guide.
-->
      このスタイルガイドに従っていないコードを扱うときには、ルールを逸脱しても構わない。
    </SUMMARY>
    <BODY>
      <p>
<!--
        If you find yourself modifying code that was written to
        specifications other than those presented by this guide, you may
        have to diverge from these rules in order to stay consistent with
        the local conventions in that code.  If you are in doubt about
        how to do this, ask the original author or the person currently
        responsible for the code.  Remember that <em>consistency</em>
        includes local consistency, too.
-->
        このガイドにあるルールではなく別の仕様に合わせて書かれたコードに手を入れることもあるだろう。その場合、ローカルなコード規約と一貫性を持たせるために、このガイドにあるルールから逸脱する必要があるかもしれない。これに疑問を感じるのであれば、そのコードの原作者や現在の責任者に尋ねよう。ローカルな一貫性も含めて、<em>一貫性</em>を持たせることを忘れないようにしよう。
      </p>
    </BODY>
  </STYLEPOINT>

  
<!--  <STYLEPOINT title="Windows Code">-->
  <STYLEPOINT title="Windowsのコード">
    <SUMMARY>
<!--      
      Windows programmers have developed their own set of coding
      conventions, mainly derived from the conventions in Windows headers
      and other Microsoft code.  We want to make it easy for anyone to
      understand your code, so we have a single set of guidelines for
      everyone writing C++ on any platform.
-->
      Windowsプログラマは自分たちのコーディング規約を作ってきた。これは主に、Windowsのヘッダファイルやその他のMicrosoftのコードに由来している。私たちはコードが誰にでも理解しやすいようにしたい。そのために私たちは、C++ を書く人たちのために、どんなプラットフォームでも使える1つのガイドラインを作った。
    </SUMMARY>
    <BODY>
      <p>
<!--
        It is worth reiterating a few of the guidelines that you might
        forget if you are used to the prevalent Windows style:
-->
        これまで蔓延しているWindowsスタイルを使っていたのなら、ガイドラインを忘れているかもしれない。もう一度言っておく必要があるだろう。
      </p>
      <ul>
<!--
        <li> Do not use Hungarian notation (for example, naming an
             integer <code>iNum</code>). Use the Google naming conventions,
             including the <code>.cc</code> extension for source files.
-->
        <li> ハンガリアン記法を使ってはいけない。（例えば、整数に <code>iNum</code> という名前を付けたり）。Googleの命名規約に従って、ソースファイルには <code>.cc</code> という拡張子を付けること。
             </li>
<!--
        <li> Windows defines many of its own synonyms for primitive
             types, such as <code>DWORD</code>, <code>HANDLE</code>, etc.
             It is perfectly acceptable, and encouraged, that you use these
             types when calling Windows API functions. Even so, keep as
             close as you can to the underlying C++ types. For example, use
             <code>const TCHAR *</code> instead of <code>LPCTSTR</code>.
-->
        <li> Windowsはプリミティブ型に様々な別名を定義している。例えば、<code>DWORD</code> や <code>HANDLE</code> など。Windows API関数を呼び出すときには、こうした型を使っても全然構わないし、むしろ使うことを推奨する。ただしできるだけ、基本となるC++の型を使うようにすること。例えば、<code>LPCTSTR</code> ではなく <code>const TCHAR *</code> を使おう。
             </li>
<!--
        <li> When compiling with Microsoft Visual C++, set the
             compiler to warning level 3 or higher, and treat all
             warnings as errors.
-->
        <li> Microsoft Visual C++ でコンパイルするときには、警告レベルを3以上に設定して、すべての警告をエラーとして扱う。
             </li>
<!--
        <li> Do not use <code>#pragma once</code>; instead use the
             standard Google include guards.  The path in the include
             guards should be relative to the top of your project
             tree.
-->
        <li> <code>#pragma once</code> を使ってはいけない。代わりに標準的なGoogleのインクルードガードを使おう。インクルードガードに使うパスはプロジェクトツリーのトップに対する相対パスにするべきだ。
             </li>
<!--
        <li> In fact, do not use any nonstandard extensions, like
             <code>#pragma</code> and <code>__declspec</code>, unless you
             absolutely must.  Using <code>__declspec(dllimport)</code> and
             <code>__declspec(dllexport)</code> is allowed; however, you
             must use them through macros such as <code>DLLIMPORT</code>
             and <code>DLLEXPORT</code>, so that someone can easily disable
             the extensions if they share the code.
-->
        <li> 実際のところ、絶対に必要なとき以外は、<code>#pragma</code> や <code>__declspec</code> といった非標準の拡張を使ってはいけない。<code>__declspec(dllimport)</code> や <code>__declspec(dllexport)</code> は使っても構わない。しかし、<code>DLLIMPORT</code> や <code>DLLEXPORT</code> といったマクロを通して使おう。こうしておくと簡単に無効にすることができる。
             </li>

      </ul>
      <p>
<!--
        However, there are just a few rules that we occasionally need
        to break on Windows:
-->
        しかし、Windowsの場合には、時々破らざるを得ないルールがいくつかある。
      </p>
      <ul>
<!--
        <li> Normally we <a HREF="#Multiple_Inheritance">forbid
             the use of multiple implementation inheritance</a>; however,
             it is required when using COM and some ATL/WTL
             classes. You may use multiple implementation inheritance
             to implement COM or ATL/WTL classes and interfaces.
-->
        <li> 私たちは通常、<a HREF="#Multiple_Inheritance">実装の多重継承を使うことを禁止</a>している。しかし、COMやATL/WTLクラスを使うときにはこれが必要になる。COMやATL/WTLクラスおよびインタフェースを実装するためであれば、実装の多重継承を使っても構わない。
             </li>
<!--
        <li> Although you should not use exceptions in your own code,
             they are used extensively in the ATL and some STLs,
             including the one that comes with Visual C++. When using
             the ATL, you should define <code>_ATL_NO_EXCEPTIONS</code> to
             disable exceptions. You should investigate whether you can
             also disable exceptions in your STL, but if not, it is OK to
             turn on exceptions in the compiler. (Note that this is
             only to get the STL to compile. You should still not
             write exception handling code yourself.)
-->
        <li> 自分で書くコードには例外を使うべきではないが、ATLやSTL、Visual C++に関連するものには、いろいろなところに例外が使われている。ATLを使うときには、例外を無効にするために <code>_ATL_NO_EXCEPTIONS</code> を定義しておくべきだ。STLでも例外を無効にできるかどうか調べるべきだが、もしできないのならコンパイラで例外を無効にすればよい。（これはSTLをコンパイルするためだけのものだということに注意しよう。例外を処理するコードを自分で書くべきではない。）
             </li>
<!--
        <li> The usual way of working with precompiled headers is to
             include a header file at the top of each source file,
             typically with a name like <code>StdAfx.h</code> or
             <code>precompile.h</code>. To make your code easier to share
             with other projects, avoid including this file explicitly
             (except in <code>precompile.cc</code>), and use the
             <code>/FI</code> compiler option to include the file
             automatically.
-->
        <li> プリコンパイルヘッダを使うときは通常、ソースファイルの先頭でヘッダファイルをインクルードする。これは通常、<code>StdAfx.h</code> や <code>precompile.h</code> という名前になっている。コードを他のプロジェクトと共有しやすくするために、明示的にファイルをインクルードするのではなく（<code>precompile.cc</code>の中を除く）、<code>/FI</code>コンパイルオプションを使って自動的にファイルがインクルードされるようにしよう。
             </li>
<!--
        <li> Resource headers, which are usually named
             <code>resource.h</code> and contain only macros, do not need
             to conform to these style guidelines.
-->
        <li> リソースヘッダは通常 <code>resource.h</code> という名前にして、マクロだけが含まれるようにする。このスタイルガイドに従う必要はない。
             </li>
      </ul>
    </BODY>
  </STYLEPOINT>

  
</CATEGORY>

<PARTING_WORDS>
  <p>
<!--
    Use common sense and <em>BE CONSISTENT</em>.
-->
    常識を働かせよう、そして、<em>一貫性</em>を持たせよう。
  </p>
  <p>
<!--
    If you are editing code, take a few minutes to look at the
    code around you and determine its style. If they use spaces
    around their <code>if</code> clauses, you should, too. If
    their comments have little boxes of stars around them, make
    your comments have little boxes of stars around them too.
-->
    ちょうどコードを書いているところなら、数分かけてまわりのコードを調べて、スタイルを決めよう。もし <code>if</code> 節のまわりに空白があるなら、あなたもそうすべきだ。もしコメントがスターで囲まれた小さなボックス状になっているなら、あなたのコメントもそうしよう。
  </p>
  <p>
<!--
    The point of having style guidelines is to have a common
    vocabulary of coding so people can concentrate on what you are
    saying, rather than on how you are saying it.  We present
    global style rules here so people know the vocabulary. But
    local style is also important.  If code you add to a file
    looks drastically different from the existing code around it,
    the discontinuity throws readers out of their rhythm when they
    go to read it. Try to avoid this.
-->
    スタイルガイドラインがあるということは、コーディングに共通のボキャブラリがあるということだ。このおかげで全員が、どうやって話すかではなく、何を話すかに集中することができる。このガイドラインでは、全体的なスタイルに関するルールについて説明した。これでボキャブラリについてはわかっただろう。しかし、ローカルなスタイルも重要だ。あなたの書いたコードが、まわりにある既存のコードと全然違っているように見えると、コードを読む人は不連続さを感じてリズムが狂ってしまう。これは避けるようにしよう。
  </p>
  
  <p>
<!--
    OK, enough writing about writing code; the code itself is much
    more interesting. Have fun!
-->
    OK、コードの書き方についてはもう十分だ。コードを書く方がずっとおもしろい。さあ、楽しもう!
  </p>
</PARTING_WORDS>

<HR/>

<p align="right">
Revision 3.133
</p>



<address>
Benjy Weinberger<br/>
Craig Silverstein<br/>
Gregory Eitzmann<br/>
Mark Mentovai<br/>
Tashana Landray<br/>
（日本語訳 <a href="http://www.textdrop.net/">Takashi Sasai</a>）
</address>

</GUIDE>
