$H

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.

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.