So, while installing my copy of ICS (currently used in D2009 and
D2010) in Delphi XE, the compile dies on:

{$IFNDEF COMPILER7_UP}
    Bomb('This component requires Delphi 7 or later');
{$ENDIF}

Which reminds me of one of my pet peeves regarding third-party
components and Delphi upgrades:
Why can't component vendors use more reliable means of detecting
versions of Delphi?  Since Delphi 6 introduced conditional compiler
expressions (CompilerVersion, RTLVersion), I avoid VER constants
whenever possible.

I was recently talking to Ray Konopka about this.  He pointed out a
legitimate concern that CompilerVersion, RTLVersion, and the VER
constants are independent and reflect different information.  For
example, he points out that CompilerVersion, RTLVersion, and the VER
constants are inconsistent.  I can see his point, and for a component
library that requires very specific knowledge of the TCustom*
components, there may be a need to check VER defines specifically.

However, VER is documented as "indicating the version number of the
Delphi compiler"
(http://docwiki.embarcadero.com/RADStudio/en/Conditional_compilation_(Delphi)).
 And so far, CompilerVersion has worked very well for me (for
detection of Delphi 6 and up, of course).

Ray still uses the VER defines.  However, he tests for every known
define.  If, at the end of the tests, no known defines are known, then
he assumes that the compiler supports the latest version that his code
is aware of.  For example, here is an excerpt from RZCOMPS.INC (which
Ray told me anyone is free to use):

// VER210 (RAD Studio 2010)

// If compiler version is unknown, assume to be VER210

{$IFDEF VER210}
  {$DEFINE USE_VER210}
{$ENDIF}

{$IFDEF VER_UNKNOWN}
  {$UNDEF VER_UNKNOWN}
  {$DEFINE USE_VER210}
{$ENDIF}

{$IFDEF USE_VER210}
// Make your Delphi 2010 defines here
{$ENDIF}

So, when compiling this code for Delphi XE, the code assumes that the
compiler/VCL is compatible with Delphi 2010.  In general, a fairly
safe assumption.  Delphi 2009 is the one major exception I can think
of where this could have caused problems.

-- 
Jon Robertson
Borland Certified Advanced Delphi 7 Developer
Good programming is 40% experience, 30% skill, 20% RTFM, 10% caffeine,
and 5% attention to detail.
--
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