From Free Pascal wiki
Jump to navigationJump to search

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.


 // String is an AnsiString
 // String is an AnsiString

 // Default; String is a ShortString

 // Default; String is a ShortString
 {$LongStrings OFF}

The {$H} or {$LONGSTRINGS} directive corresponds to the -Sh command line option.