Difference between revisions of "$H"
From Lazarus wiki
Jump to navigationJump to search (English translation of German page with extra info from FPC manual) |
m (fix syntax error in example code) |
||
Line 13: | Line 13: | ||
The default is {$H-}. The reserved word [[String]] is a [[Shortstring|ShortString]]. | The default is {$H-}. The reserved word [[String]] is a [[Shortstring|ShortString]]. | ||
− | The compiler mode {$MODE DELPHI} implies a {$H+} statement, all other modes switch it off. As a result, you should always put {$H+} after a mode directive. | + | The compiler mode {$MODE DELPHI} implies a {$H+} statement, all other modes switch it off. As a result, you should always put {$H+} after a mode directive. |
Example: | Example: | ||
Line 22: | Line 22: | ||
// String is an AnsiString | // String is an AnsiString | ||
− | {$LONGSTRINGS ON | + | {$LONGSTRINGS ON} |
// Default; String is a ShortString | // Default; String is a ShortString |
Latest revision as of 05:21, 23 June 2020
│
Deutsch (de) │
English (en) │
Back to local compiler directives.
The $H or $LONGSTRINGS local compiler directives have the same meaning and determine whether the compiler interprets the reserved word String as an AnsiString.
The $LONGSTRINGS directive uses the ON and OFF switches.
The $H directive uses the + and - switches.
The default is {$H-}. The reserved word String is a ShortString.
The compiler mode {$MODE DELPHI} implies a {$H+} statement, all other modes switch it off. As a result, you should always put {$H+} after a mode directive.
Example:
// String is an AnsiString
{$H+}
// String is an AnsiString
{$LONGSTRINGS ON}
// Default; String is a ShortString
{$H-}
// Default; String is a ShortString
{$LongStrings OFF}
The {$H} or {$LONGSTRINGS} directive corresponds to the -Sh command line option.