Undelcared identifier error: SListIndexError

CodeGear Delphi 2007, 2009
The SListIndexError is a constant string declared in Delphi 4 in the unit Consts.
SListIndexError since Delphi 6 is in the unit RTLConsts.
The first and the most competent method is to resort to conditional compilation directives:
{$IF CompilerVersion >= 14.0} // Delphi 6 and higher RTLConsts {$ELSE} Consts {$IFEND}
The second remedy:
The construction Error(SListIndexError, Index) may be replaced by Error('List Index out of bounds (%d)', Index)

TIOBE Index for August 2026

The TIOBE Programming Community index is an indicator of the popularity of programming languages. The index is updated once a month. The ratings are based on the number of skilled engineers world-wide, courses and third party vendors. Popular web sites Google, Amazon, Wikipedia, Bing and more than 20 others are used to calculate the ratings. It is important to note that the TIOBE index is not about the best programming language or the language in which most lines of code have been written. The index can be used to check whether your programming skills are still up to date or to make a strategic decision about what programming language should be adopted when starting to build a new software system.
TIOBE Index for August 2026

TIOBE index

String, AnsiString in Delphi 2007, in Delphi 2009. Differences and Migration Implications

CodeGear Delphi 2007, 2009
Official Unicode support was added in Delphi 2009 with code name Tiburón.

In Delphi Versions <= 2007, string was an alias for AnsiString (a single-byte character string type).
In Delphi Versions >= 2009, this changed, and string became an alias for UnicodeString (a multi-byte, UTF-16 character string type), while AnsiString remained available as a type for 8-bit character data.

The change was a major shift to include full Unicode support and has significant implications for code written in Delphi <= 2007 that is being migrated to Delphi 2009 or later.

Key Differences and Migration Implications

In Delphi 2007 and older (ANSI) Length() returns number of bytes, in Delphi 2009 and newer (Unicode) returns number of characters (elements).

String Alias:
  • Delphi 2007 and earlier: String = AnsiString. The data was 8-bit and its interpretation (code page) was generally linked to the operating system's regional settings.
  • Delphi 2009 and later: String = UnicodeString. The data is 16-bit (WideChar), typically using UTF-16 encoding, allowing for a broad range of characters.
Character Types:
  • Delphi 2007: Char = AnsiChar (8-bit).
  • Delphi 2009: Char = WideChar (16-bit).
Type / Function Delphi 7, 2007 Delphi 2009, XE
byte byte byte (no change)
String AnsiString UnicodeString
Char AnsiChar WideChar
PChar PAnsiChar PWideChar
SizeOf(Char) 1 byte 2 bytes

Data Handling:
  • Direct assignments between AnsiString and the new UnicodeString in Delphi 2009 involve implicit conversions, which can cause to performance issues or, more importantly, data loss if not handled carefully. The compiler will often issue warnings for these conversions.
  • The internal structure of AnsiString itself changed slightly between versions (e.g., in Delphi 2009, it stores a code page number, which was not present in Delphi 2007's AnsiString), making sharing strings between DLLs compiled with different versions problematic.

Migration pieces of Advice

To migrate code that uses strings between these versions, you generally have preferred approaches:
  1. Explicitly Ansi-fy the Code (Short-term fix): Replace all instances of the generic string, Char, and PChar with their explicit 8-bit equivalents: AnsiString, AnsiChar and PAnsiChar. This retains the old behavior but means your application will not leverage Unicode natively and will still encounter conversion overhead when interacting with the rest of the Unicode VCL/RTL in Delphi 2009.
  2. Resort to Unicode: Update your code to use the native UnicodeString type throughout your application. Use AnsiString only at the boundaries where you interact with legacy data, files, or external APIs that require ANSI encoding (e.g., when saving or loading data from an older database). Use functions like TEncoding.GetString to properly decode data.
  3. The correction isn’t simple recompilation, but to audit every PChar, every SizeOf(Char) assumption, and every place where raw bytes to a file or socket expecting ANSI.// Delphi <= 2007 code — assumes 1 byte per char, breaks silently under Unicode procedure TrimBuffer(var Buf: array of Char; MaxLen: Integer); var P: PChar; begin P := @Buf[0]; Inc(P, MaxLen); // wrong stride Char is 2 bytes P^ := #0; end;
  4. Compiler directives and conditional code if code must support both old and new Delphi versions simultaneously.
    The Version constants are not intuitive but they may lead to mistakes:

    {$IFDEF VER150} // Delphi 7 {$IFDEF VER185} // Delphi 2007 Win32 has VER180 & VER185 {$IFDEF VER200} // Delphi 2009 Tiburon {$IFDEF VER210} // Delphi 2010 Weaver

    Another way to use the UNICODE directive:
    {$IFDEF UNICODE} // Delphi 2009+ logic {$ELSE} // Legacy Delphi logic {$ENDIF}

    Prefer to use CompilerVersion than Version constants
    ...
    If the codebase has already passed one migration, it likely has {$IFDEF} blocks keyed to old version constants. Don’t delete these blindly — audit each one with attention.
    Use code with caution!
  5. Compile and watch Fix Warnings: Pay close attention to "Implicit string cast" warnings. They highlight where the compiler is silently converting between ANSI and Unicode strings, which can cause data loss or unplanned behavior.
  6. Character Buffer Allocations with SetLength and GetMem
    If code allocates memory based on the assumption that 1 character equals 1 byte, it will allocate only half the required memory in Delphi 2009+, leading to buffer overflows.
    Length returns the number of elements in the string or in an array. Length for the strings with 8 bit element types (ANSI, UTF-8) gives the number of bytes since the number of bytes is the same as the number of elements, but the Length for the strings with 16 bit elements (UTF-16) is half the number of bytes because each element has 2 bytes.
    Wrong Code:
    GetMem(Buffer, Length(MyString)); // Allocates half the needed bytes!
    Correct Code
    GetMem(Buffer, Length(MyString) * SizeOf(Char));
  7. File I/O (BlockRead / BlockWrite & TStream) in reading or writing strings directly to files using raw byte streams will now write 2 bytes per character, breaking backwards compatibility with old file formats.
    Fix, if you need to save text files in traditional ANSI/ASCII format, explicitly use AnsiString or pass TEncoding.ANSI (e.g., StringList.LoadFromFile('file.txt', Tencoding.ANSI)) to TStringList.SaveToFile or TStringList.LoadFromFile.

    var LegacyStr: AnsiString; begin LegacyStr := AnsiString(MyUnicodeString); Stream.Write(LegacyStr[1], Length(LegacyStr)); end;

  8. Windows API Calls brings surprises out of (PChar casting)
    Delphi automatically maps Windows API functions to their Unicode (W) variants instead of ANSI (A) variants.
    For example: SetWindowText calls the SetWindowTextW.
    If PAnsiChar is explicitly being passed to an API that now expects PWideChar, the compiler will give error. Types must be updated to PChar to let Delphi handle it natively, or explicitly call SetWindowTextA if the ANSI is used.
  9. Pointer math must be reviewed: if a PChar pointer Inc(P) is incremented, it now jumps by 2 bytes instead of 1. If there is manual byte-level parsing, the pointer type must be changed to PByte or PAnsiChar.
  10. If old code used string or AnsiString as binary Data buffers to load raw binary data, encrypted data, or file streams, this will now break because the runtime will try to parse or convert invalid UTF-16 surrogate pairs.
    Change the variable type from string to RawByteString or TBytes (an array of bytes) to fix and completely bypass Unicode conversion logic.
  11. Ensure that database drivers and components are updated to versions that support Unicode data types (TWideStringField instead of TStringField if storing non-ASCII data).

The ANSI function to Ansi-fy. This table is not a divine revelation, but my personal reference book.


Ansi-fy Wide Char, Unicode Units
const C = '...'; const C: AnsiString = '...';
CompareText AnsiCompareText SysUtils; AnsiStrings
CompareStr AnsiCompareStr SysUtils; AnsiStrings
FindWindow FindWindowA FindWindowW
(in Delphi Versions >= 2009 the same as FindWindowW)
GetDiskFreeSpace GetDiskFreeSpaceA GetDiskFreeSpace
(in Delphi Versions >= 2009 calls GetDiskFreeSpaceW)
Windows
GetTempPath GetTempPathA GetTempPath
(in Delphi Versions >= 2009 calls GetTempPathW)
Windows
ShellExecute ShellExecuteA ShellExecuteW
(in Delphi Versions >= 2009 the same as ShellExecute)
ShellApi
ShellExecute ShellExecuteA ShellExecuteW
(in Delphi Versions >= 2009 the same as ShellExecute)
ShellApi
ShellExecuteInfo ShellExecuteInfoA ShellExecuteInfoW
(in Delphi Versions >= 2009 the same as ShellExecuteInfo)
SHGetPathFromIDList SHGetPathFromIDListA SHGetPathFromIDList
(in Delphi Versions >= 2009 calls SHGetPathFromIDListW)
ShlObj
StrAlloc AnsiStrAlloc in Delphi Versions >= 2009 StrAlloc calls WideStrAlloc SysUtils

Delphi 2009 has got the unit AnsiStrings.pas appeared in ..\source\Win32\rtl\common.
This article will not be complete, some text was removed intentionally. If you are unable to apply this, please contact for paid consultation.
Данная статья не будет полной, часть текста была удалена намеренно. Если вам не удалось применить, обращайтесь за платной консультацией.

Delphi Version in Windows System Registry

Initially the project was made October 27, 2010 by Rodrigo Ruz
The essence of the project is to detect the Delphi (or Rad-Studio) versions installed in a system by check the existence of registry keys under the HKEY_CURRENT_USER root. Good illustration to the article Default system registry path for Delphi and C++Builder

The project was simplified, only one form was left and newer Delphi versions from XE2 up to Delphi 13 Florence were added.
The Delphi version remained the same - 2007
Checked in Delphi 2007
Date last modified: August 25, 2026

The project Delphi Version in System Registry is available in My Github Repository

Default system registry path for Delphi and C++Builder

Embarcadero logo
User Settings Root folder - HKEY_CURRENT_USER
Shared/Global Settings Root folder - HKEY_LOCAL_MACHINE
Delphi logo

Delphi


Borland Delphi 2Software\Borland\Delphi\2.0
Borland Delphi 3Software\Borland\Delphi\3.0
Borland Delphi 4Software\Borland\Delphi\4.0
Borland Delphi 5Software\Borland\Delphi\5.0
Borland Delphi 6Software\Borland\Delphi\6.0
Borland Delphi 7Software\Borland\Delphi\7.0
Borland Delphi 8Software\Borland\Delphi\8.0
Borland Developer Studio 2005 DiamondbackSoftware\Borland\BDS\3.0
Borland Developer Studio 2006Software\Borland\BDS\4.0
CodeGear RAD Studio 2007Software\Borland\BDS\5.0
CodeGear RAD Studio 2009Software\Borland\BDS\6.0
CodeGear RAD Studio 2010Software\Borland\BDS\7.0
Embarcadero RAD Studio XESoftware\Embarcadero\BDS\8.0
Embarcadero RAD Studio XE2Software\Embarcadero\BDS\9.0
Embarcadero RAD Studio XE3Software\Embarcadero\BDS\10.0
Embarcadero RAD Studio XE4Software\Embarcadero\BDS\11.0
Embarcadero RAD Studio XE5Software\Embarcadero\BDS\12.0
Embarcadero RAD Studio XE6Software\Embarcadero\BDS\14.0
Embarcadero RAD Studio XE7Software\Embarcadero\BDS\15.0
Embarcadero RAD Studio XE8Software\Embarcadero\BDS\16.0
Embarcadero RAD Studio 10.0 SeattleSoftware\Embarcadero\BDS\17.0
Embarcadero RAD Studio 10.1 BerlinSoftware\Embarcadero\BDS\18.0
Embarcadero RAD Studio 10.2 TokyoSoftware\Embarcadero\BDS\19.0
Embarcadero RAD Studio 10.3 RioSoftware\Embarcadero\BDS\20.0
Embarcadero RAD Studio 10.4 SydneySoftware\Embarcadero\BDS\21.0
Embarcadero RAD Studio 11 AlexandriaSoftware\Embarcadero\BDS\22.0
Embarcadero RAD Studio 12 AthensSoftware\Embarcadero\BDS\23.0
Embarcadero RAD Studio 13 FlorenceSoftware\Embarcadero\BDS\37.0

Software implementation

C++Builder logo

C++Builder


Borland C++Builder 1Software\Borland\C++Builder\1.0
Borland C++Builder 3Software\Borland\C++Builder\3.0
Borland C++Builder 4Software\Borland\C++Builder\4.0
Borland C++Builder 5Software\Borland\C++Builder\5.0
Borland C++Builder 6Software\Borland\C++Builder\6.0
Borland Developer Studio 2006Software\Borland\BDS\4.0
CodeGear RAD Studio 2007Software\Borland\BDS\5.0
CodeGear RAD Studio 2009Software\Borland\BDS\6.0
CodeGear RAD Studio 2010Software\Borland\BDS\7.0
Embarcadero RAD Studio XESoftware\Embarcadero\BDS\8.0
Embarcadero RAD Studio XE2Software\Embarcadero\BDS\9.0
Embarcadero RAD Studio XE3Software\Embarcadero\BDS\10.0
Embarcadero RAD Studio XE4Software\Embarcadero\BDS\11.0
Embarcadero RAD Studio XE5Software\Embarcadero\BDS\12.0
Embarcadero RAD Studio XE6Software\Embarcadero\BDS\14.0
Embarcadero RAD Studio XE7Software\Embarcadero\BDS\15.0
Embarcadero RAD Studio XE8Software\Embarcadero\BDS\16.0
Embarcadero RAD Studio 10.0 SeattleSoftware\Embarcadero\BDS\17.0
Embarcadero RAD Studio 10.1 BerlinSoftware\Embarcadero\BDS\18.0
Embarcadero RAD Studio 10.2 TokyoSoftware\Embarcadero\BDS\19.0
Embarcadero RAD Studio 10.3 RioSoftware\Embarcadero\BDS\20.0
Embarcadero RAD Studio 10.4 SydneySoftware\Embarcadero\BDS\21.0
Embarcadero RAD Studio 11 AlexandriaSoftware\Embarcadero\BDS\22.0