Option OPT (Delphi)
Go Up to Delphi Compiler Directives (List) Index
Type
Switch
Syntax
{$PUSHOPT} or {$POPOPT}
Scope
Local
Remarks
These Delphi compiler directives save and restore the current set of options and warning configurations.
{$PUSHOPT}
{$PUSHOPT} allows you to save all, or a selected subset, of compiler options before including any files that might alter multiple compiler settings or warning configurations.
{$POPOPT}
{$POPOPT} restores compiler options and warnings by removing the most recent set from the stack.
Unbalanced Directives Warnings
In case of a mismatch in the directives' usage, it will issue the following warning:
W1078 {$POPOPT} with no matching {$PUSHOPT} in %s
If at $POPOPT there is more $POPOPT than $PUSHPOPT in a file, this warning will be displayed:
W1079 Previous {$PUSHOPT} on line %ld not restored
The same warning will be produced at the end of the source file (and include file) if there are more $PUSHOPT than $POPOPT in a file.
Eligible Options List
Not all options and settings are eligible for these new directives. Here is the list of the options considered:
| Directives | Short Forms |
|---|---|
| {$ALIGN ON/OFF/1/2/4/8/16} | {$A+} {$A-} {$A1} {$A2} {$A4} {$A8} {$A16} |
| {$BOOLEVAL ON/OFF} | {$B+} {$B-} |
| {$ASSERTIONS ON/OFF} | {$C+} {$C-} |
| {$ASSERTIONS ON/OFF} | {$C+} {$C-} |
| {$DEBUGINFO ON/OFF/0/1/2} | {$D0} {$D1} {$D2} |
| {$OLDOBJWARN} | {$E+} {$E-} |
| {$IMPOTEDDATA ON/OFF} | {$G+} {$G-} |
| {$LONGSTRINGS ON/OFF} | {$H+} {$H-} |
| {$IOCHECKS ON/OFF} | {$I+} {$I-} |
| {$WRITEABLECONST ON/OFF} | {$J+} {$J-} |
| {$LOCALSYMBOLS ON/OFF} | {$L+} {$L-} |
| {$TYPEINFO ON/OFF} | {$M+} {$M-} |
| {$OPTIMIZATION ON/OFF} | {$O+} {$O-} |
| {$OPENSTRINGS ON/OFF} | {$P+} {$P-} |
| {$OVERFLOWCHECKS ON/OFF} | {$Q+} {$Q-} |
| {$RANGECHECKS ON/OFF} | {$R+} {$R-} |
| {$STACKCHECKS ON/OFF} | {$S+} {$S-} |
| {$TYPEDADDRESS ON/OFF} | {$T+} {$T-} |
| {$SAFEDIVIDE ON/OFF} | {$U+} {$U-} |
| {$VARSTRINGCHECKS ON/OFF} | {$V+} {$V-} |
| {$STACKFRAMES ON/OFF} | {$W+} {$W-} |
| {$EXTENDEDSYNTAX ON/OFF} | {$X+} {$X-} |
| {$REFERENCEINFO ON/OFF} | {$Y+} {$Y-} |
| {$DEFINITIONINFO ON/OFF} | {$YD} |
| {$MINENUMSIZE 1/2/4} | {$Z+} {$Z-} {$Z1} {$Z2} {$Z4} |
| {$AUTOBOX ON/OFF} | |
| {$FINITEFLOATT ON/OFF} | |
| {$HINTS ON/OFF} | |
| {$IMPLICITBUILD ON/OFF} | |
| {$REALCOMPATIBILITY ON/OFF} | |
| {$UNSAFECODE ON/OFF} | |
| {$METHODINFO ON/OFF} | |
| {$NATIVE_CPP_INTERFACES ON/OFF} | |
| {$SCOPEDENUMS ON/OFF} | |
| {$POINTERMATH ON/OFF} | |
| {$COMPATIBLELITERALS ON/OFF} | |
| {$HIGHCHARUNICODE ON/OFF} | |
| {$OLDTYPELAYOUT ON/OFF} | |
| {$WEAKLINKRTTI ON/OFF} | |
| {$STRONGLINKTYPES ON/OFF} | |
| {$EXCESSPRECISION ON/OFF} | |
| {$EXTENDEDCOMPATIBILITY ON/OFF} | |
| {$ZEROBASEDSTRINGS ON/OFF} | |
| {$LEGACYIFEND ON/OFF} | |
| {$WARN (<ident>|ALL) ON/OFF/DEFAULT/ERROR} | |
| {$CODEALIGN 0/1/2/4/8/16} | |
| {$MAXPAGESIZE <intconst>} | |
| {$DESIGNONLY ON/OFF} | |
| {$RUNONLY ON/OFF} | |
| {$VARPROPSETTER ON/OFF} | |
| {$DUPLICATEENABLE ON/OFF} | |
| {$RTTI (EXPLICIT|INHERIT) {(METHOD|FIELD|PROPERTY)(<set const expr: TRttiVisibility>)} | |
| {$INLINE ON/OFF/AUTO} | |
| {$WARNINGS ON/OFF/ERROR} | |
| {$TEXTBLOCK ( NATIVE/CR/LF/CRLF ) [ LANGUAGE ]} |