Sign in Join
Wiki copytemporary

$H: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: $H

OldNewLine
1+Back to [[local compiler directives]].
2+
3+The **\$H** or **\$LONGSTRINGS** local compiler directives have the same meaning and determine whether the compiler interprets the reserved word [[String]] as an [[Ansistring|AnsiString]].
4+
5+The \$LONGSTRINGS directive uses the ON and OFF switches.
6+
7+The \$H directive uses the + and - switches.
8+
9+The default is {\$H-}. The reserved word [[String]] is a [[Shortstring|ShortString]].
10+
11+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.
12+
13+Example:
14+
15+``` pascal
16+ // String is an AnsiString
17+ {$H+}
18+
19+ // String is an AnsiString
20+ {$LONGSTRINGS ON}
21+
22+ // Default; String is a ShortString
23+ {$H-}
24+
25+ // Default; String is a ShortString
26+ {$LongStrings OFF}
27+```
28+
29+The {\$H} or {\$LONGSTRINGS} directive corresponds to the **-Sh** command line option.
30+
31+---
32+*From the Free Pascal wiki, page "$H", as it stood on 2020-06-23 after a change by Kai Burghardt, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history