As for me, I counted current compilers.inc code not-optimal too so I redesigned 
it. Haven't tested it with .Net or Linux (these targets use quite different 
approach) but Windows versions seem working OK.
Here's my version:

// Compiler defines not specific to a particlular platform.

  // BDS 2010 (BDS 7.0)
  {$ifdef VER210}
    {$define COMPILER_13}
    {$define COMPILER_13_UP}
  {$endif}

  // BDS 2009 (BDS 6.0)
  {$ifdef VER200}
    {$define COMPILER_12}
    {$define COMPILER_12_UP}
  {$endif}

  // BDS 2007 (BDS 5.0)
  {$ifdef VER190}
    {$define COMPILER_11}
    {$define COMPILER_11_UP}
  {$endif}

  // BDS 2006 (BDS 4.0)
  {$ifdef VER180}
    {$define COMPILER_10}
    {$define COMPILER_10_UP}
  {$endif}

  // DELPHI 9
  {$ifdef VER170}
    {$define COMPILER_9}
    {$define COMPILER_9_UP}
  {$endif}
  
  // DELPHI 8
  {$ifdef VER160}
    {$define COMPILER_8}
    {$define COMPILER_8_UP}
  {$endif}

  // DELPHI 7
  {$ifdef VER150}
    {$define COMPILER_7}
    {$define COMPILER_7_UP}
  {$endif}

  // DELPHI/CPPB 6
  {$ifdef VER140}
    {$define COMPILER_6}
    {$define COMPILER_6_UP}
  {$endif}

  // DELPHI/CPPB 5
  {$ifdef VER130}
    {$define COMPILER_5}
    {$define COMPILER_5_UP}
  {$endif}

  // CPPB 4
  {$ifdef VER125}
    {$define COMPILER_4}
    {$define COMPILER_4_UP}
  {$endif}

  // DELPHI 4
  {$ifdef VER120}
    {$define COMPILER_4}
    {$define COMPILER_4_UP}
  {$endif}

  // CPPB 3
  {$ifdef VER110}
    {$define COMPILER_3}
    {$define COMPILER_3_UP}
  {$endif}

  // DELPHI 3
  {$ifdef VER100}
    {$define COMPILER_3}
    {$define COMPILER_3_UP}
  {$endif}

  // CPPB 1
  {$ifdef VER93}
    {$define COMPILER_2} // C++ Builder v1 compiler is really v2
    {$define COMPILER_2_UP}
  {$endif}

  // DELPHI 2
  {$ifdef VER90}
    {$define COMPILER_2}
    {$define COMPILER_2_UP}
  {$endif}

  // DELPHI 1
  {$ifdef VER80}
    {$define COMPILER_1}
    {$define COMPILER_1_UP}
  {$endif}

{$else (not Windows)}
  // Linux is the target
  {$define QT_CLX}

  // KYLIX 1/2
  {$ifdef VER140}
    {$define COMPILER_6}
    {$define COMPILER_6_UP}
  {$endif}

  // KYLIX 3
  {$ifdef VER150}
    {$define COMPILER_7}
    {$define COMPILER_7_UP}
  {$endif}

{$endif Win32}

//
{$ifdef COMPILER_13_UP}
  {$define COMPILER_12_UP}
{$endif}

{$ifdef COMPILER_12_UP}
  {$define COMPILER_11_UP}
{$endif}

{$ifdef COMPILER_11_UP}
  {$define COMPILER_10_UP}
{$endif}

{$ifdef COMPILER_10_UP}
  {$define COMPILER_9_UP}
{$endif}

{$ifdef COMPILER_9_UP}
  {$define COMPILER_8_UP}
{$endif}

{$ifdef COMPILER_8_UP}
  {$define COMPILER_7_UP}
{$endif}

{$ifdef COMPILER_7_UP}
  {$define COMPILER_6_UP}
{$endif}

{$ifdef COMPILER_6_UP}
  {$define COMPILER_5_UP}
{$endif}

{$ifdef COMPILER_5_UP}
  {$define COMPILER_4_UP}
{$endif}

{$ifdef COMPILER_4_UP}
  {$define COMPILER_3_UP}
{$endif}

{$ifdef COMPILER_3_UP}
  {$define COMPILER_2_UP}
{$endif}

{$ifdef COMPILER_2_UP}
  {$define COMPILER_1_UP}
{$endif}

So when a new compiler is released all we need to add is just 4+3=7 lines of 
copy-pasted code. Maybe this way would be more optimal than current one?

-- 
Anton
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to