title: Include File Ordering Strategy
body: <p>I've seen fairly consistent advice that an implementation file (.cc / .cpp) should include its corresponding class <a href="https://stackoverflow.com/questions/1014632/clean-up-your-include-statements">definition file <em>first</em></a>, before including other header files.  But when the topic shifts to header files themselves, and the order of includes they contain, the advice seems to vary.</p>
  
  <p><a href="http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml?showone=Names_and_Order_of_Includes#Names_and_Order_of_Includes" rel="nofollow noreferrer">Google coding standards</a> suggest:</p>
  
  <ol>
  <li>dir2/foo2.h (preferred location — see details below). </li>
  <li>C system files. </li>
  <li>C++ system files. </li>
  <li>Other libraries' .h files. </li>
  <li>Your project's .h files. </li>
  </ol>
  
  <p>It is unclear what the difference is between entry 1 and 5 above, and why one or the other location would be chosen.  That said, <a href="http://www.possibility.com/Cpp/CppCodingStandard.html" rel="nofollow noreferrer">another online guide</a> suggests this order (found in the "Class Layout" section of that doc):</p>
  
  <ol>
  <li>system includes</li>
  <li>project includes</li>
  <li>local includes</li>
  </ol>
  
  <p>Once again there is an ambiguity, this time between items 2 and 3.  What is the distinction?  Do those represent inter-project and intra-project includes?</p>
  
  <p>But more to the point, it looks as if both proposed coding standards are suggesting "your" header files are included last.  Such advice, being backwards from what is recommended for include-ordering in implementation files, is not intuitive.  Would it not make sense to have "your" header files consistently listed first - ahead of system and 3rd party headers?</p>