Difference between revisions of "Compiler Mode"
From Free Pascal wiki
Jump to navigationJump to search (→Modes: ISO mode) |
(internal links) |
||
Line 6: | Line 6: | ||
== Modes == | == Modes == | ||
− | *Free Pascal: {$mode '''FPC'''}<br/>This is the original Free Pascal compiler mode. As of version 3, It is the ''default mode'' of the compiler, so it is not necessary to explicitly add this directive. | + | *Free Pascal: {$[[Mode FPC|mode '''FPC''']]}<br/>This is the original Free Pascal compiler mode. As of version 3, It is the ''default mode'' of the compiler, so it is not necessary to explicitly add this directive. |
− | *Extended Free Pascal: {$mode '''OBJFPC'''} <br/>This mode adds extra functionality to the '''FPC''' mode, including [[Class | classes]], [[Interface|interfaces]] and [[language/features/exception handling|exceptions]]. | + | *Extended Free Pascal: {$[[Mode ObjFPC|mode '''OBJFPC''']]} <br/>This mode adds extra functionality to the '''FPC''' mode, including [[Class | classes]], [[Interface|interfaces]] and [[language/features/exception handling|exceptions]]. |
− | *Turbo Pascal: {$mode '''TP'''} <br/>This is the [[Turbo Pascal]] compatibility mode. | + | *Turbo Pascal: {$[[Mode TP|mode '''TP''']]} <br/>This is the [[Turbo Pascal]] compatibility mode. |
− | *Delphi: {$mode '''DELPHI'''} <br/>This is the [[Delphi]] compatibility mode. | + | *Delphi: {$[[Mode Delphi|mode '''DELPHI''']]} <br/>This is the [[Delphi]] compatibility mode. |
− | *Mac Pascal: {$mode '''MacPAS'''}<br/>The [[Mac Pascal]] compatibility mode. | + | *Mac Pascal: {$[[Mode MacPas|mode '''MacPAS''']]}<br/>The [[Mac Pascal]] compatibility mode. |
− | *ISO 7185 Standard Pascal: {$mode '''ISO'''}<br/>The ISO 7185 standard compatibility mode. The ISO 7185 standard is also known as [[Standard Pascal]]. | + | *ISO 7185 Standard Pascal: {$[[Mode iso|mode '''ISO''']]}<br/>The ISO 7185 standard compatibility mode. The ISO 7185 standard is also known as [[Standard Pascal]]. |
== ModeSwitch == | == ModeSwitch == |
Revision as of 03:41, 12 September 2017
│
Deutsch (de) │
English (en) │
español (es) │
suomi (fi) │
français (fr) │
中文(中国大陆) (zh_CN) │
The Free Pascal compiler will compile in a specific mode. Each mode dictates what syntax the compiler accepts as valid, and what it considers as invalid. The compiler mode can be set in the source code with the {$mode } compiler directive, or on the command line with the -M command line option.
Modes
- Free Pascal: {$mode FPC}
This is the original Free Pascal compiler mode. As of version 3, It is the default mode of the compiler, so it is not necessary to explicitly add this directive.
- Extended Free Pascal: {$mode OBJFPC}
This mode adds extra functionality to the FPC mode, including classes, interfaces and exceptions.
- Turbo Pascal: {$mode TP}
This is the Turbo Pascal compatibility mode.
- Delphi: {$mode DELPHI}
This is the Delphi compatibility mode.
- Mac Pascal: {$mode MacPAS}
The Mac Pascal compatibility mode.
- ISO 7185 Standard Pascal: {$mode ISO}
The ISO 7185 standard compatibility mode. The ISO 7185 standard is also known as Standard Pascal.
ModeSwitch
As of version 2.3.1 of Free Pascal, the {$ModeSwitch} compiler directive has been added to allow features of a compiler mode to be selectively added to the current mode, effectively creating a custom mode. For example:
{$mode FPC}
{$ModeSwitch EXCEPTIONS}
Will add exception handling to the FPC compiler mode.