Name

$LongStrings Compiler Directive

Syntax

{$H+}             // default
{$LongStrings On} // default
{$H-}
{$LongStrings Off}

Scope

Local

Description

By default, Delphi interprets the string type to mean AnsiString. If you disable the $LongStrings compiler directive, Delphi reverts to the Delphi 1 behavior where string is a ShortString.

Most new Delphi programs rely on long strings, which are much easier to use than short strings. Disable $LongStrings only to preserve compatibility with Delphi 1.

See Also

AnsiString Type, ShortString Type, String Keyword

Get Delphi in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.