title: Trailing underscores for member variables in C++
body: <p>I've seen people use a trailing underscore for member variables in classes, for instance in the renowned <a href="http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.11" rel="noreferrer">C++ FAQ Lite</a>.</p>
  
  <p>I think that it's purpose is not to mark variables as members, that's what "m_" is for. It's actual purpose is to make it possible to have an accessor method named like the field, like this:</p>
  
  <pre><code>class Foo {
  public:
      bar the_bar() { return the_bar_; }
  private:
      bar the_bar_;
  }
  </code></pre>
  
  <p>Having accessors omit the "get_" part is common in the STL and boost, and I'm trying to develop a coding style as close to these as possible, but I can't really see them using the underscore trick. I wasn't able to find an accessor in STL or boost that would just return a private variable.</p>
  
  <p>I have a few questions I'm hoping you will be able to answer:</p>
  
  <ol>
  <li>Where does this convention come from? Smalltalk? Objective-C? Microsoft? I'm wondering.</li>
  <li>Would I use the trailing underscore for all private members or just as a workaround in case I want to name a function like a variable?</li>
  <li>Can you point me to STL or boost code that demonstrates trailing underscores for member variables?</li>
  <li>Does anybody know what Stroustrup's views on the issue are?</li>
  <li>Can you point me to further discussion of the issue?</li>
  </ol>