title: Detecting compiler versions during compile time
body: <p>This is both a question and a reference and I am hoping that people can build upon this so that it can be reused by people with similar questions.</p>
  
  <p>How can we reliably detect a particular version of a C/C++/ObjC compiler?  Now I know the answer for Visual Studio and partially know the answer for Xcode.</p>
  
  <p>Now for the Visual Studio compiler we have _MSC_VER which is defined with these values:</p>
  
  <pre><code>Version 1.0    800
  Version 2.0    900
  Version 2.x    900
  Version 4.0    1000
  Version 5.0    1100
  Version 6.0    1200
  Version 7.0    1300
  Version 7.1    1310
  Version 8.0    1400  (Visual Studio 2005)
  Version 9.0    1500  (Visual Studio 2008)
  Version 10.0   1600  (Visual Studio 2010)
  Version 11.0   1700  (Visual Studio 2012)
  </code></pre>
  
  <p>Now for the Xcode compiler we have this define:</p>
  
  <pre><code>__APPLE_CC__
  </code></pre>
  
  <p>But the only values I've managed to find via google (Mac docs don't seem to have these values) are:</p>
  
  <pre><code>Xcode 3.0              5465
  Xcode 3.1              5470
  Xcode 3.1 (GCC 4.2)    5553
  Xcode 3.2.3            5664  (Got this value from my own compiler)
  </code></pre>
  
  <p>Can anyone complete this list or provide links to a full list?  And maybe we can provide information for other compilers too.</p>