Sign in Join
Wiki copytemporary

Compiler Mode/zh CN: what changed

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

OldNewLine
1-[[FPC]] 旨在成为商业 [[Pascal]] 编译器的(部分)自由开源替代品。 为了实现这一目标,引入了一个编译器开关来确定“编译器兼容模式”。
1+[[FPC]] 旨在成为商业 [[Pascal]] 编译器的(部分)自由开源替代品。 为了实现这一目标,引入了一个编译器开关来确定“编译器兼容模式”。
22
3-每种模式都隐含地启用或禁用某些语法要求或其他语言结构。 其中一些可以通过所谓的“模式开关”单独启用或禁用,详见下文。
3+每种模式都隐含地启用或禁用某些语法要求或其他语言结构。 其中一些可以通过所谓的“模式开关”单独启用或禁用,详见下文。
44
55## modes 模式
66
7-编译器兼容模式可以在[[Source code|源代码]]中通过[[global compiler directives|全局编译器指令]]`{$mode}`指定,或者通过命令行或`fpc.cfg(5)`参数`-M`指定。
7+编译器兼容模式可以在[[Source code|源代码]]中通过[[global compiler directives|全局编译器指令]]`{$mode}`指定,或者通过命令行或`fpc.cfg(5)`参数`-M`指定。
88
9-以下是识别的九种编译器兼容模式:
9+以下是识别的九种编译器兼容模式:
1010
11- * Free Pascal ([[Mode FPC|`{$mode FPC}`]], `-MFPC`)
11+- Free Pascal ([[Mode FPC|{$mode FPC}]], `-MFPC`)
1212
13- 这是原始的 FPC 模式。从 FPC 3.x 开始,如果源代码或命令行没有明确指定编译器兼容模式,这将是“默认模式”。
13+
14+这是原始的 FPC 模式。从 FPC 3.x 开始,如果源代码或命令行没有明确指定编译器兼容模式,这将是“默认模式”。
1415
15- * Object Pascal ([[Mode ObjFPC|`{$mode objFPC}`]], `-MobjFPC` 或 `-S2`)
16+- Object Pascal ([[Mode ObjFPC|{$mode objFPC}]], `-MobjFPC` 或 `-S2`)
1617
17- 此模式为 `FPC` 模式添加了额外功能,包括但不限于 [[Class|类]]、[[Interface|接口]] 和 [[Exceptions|异常]]。
18+
19+此模式为 `FPC` 模式添加了额外功能,包括但不限于 [[Class|类]]、[[Interface|接口]] 和 [[Exceptions|异常]]。
1820
19- * [[Turbo Pascal]] ([[Mode TP|`{$mode TP}`]], `-MTP` 或 `-So`)
21+- [[Turbo Pascal]] ([[Mode TP|{$mode TP}]], `-MTP` 或 `-So`)
2022
21- 这是 Turbo Pascal 兼容模式。它试图与 Borland TP 7.0 兼容,例如通过禁用函数重载。
23+
24+这是 Turbo Pascal 兼容模式。它试图与 Borland TP 7.0 兼容,例如通过禁用函数重载。
2225
23- * [[Delphi]] ([[Mode Delphi|`{$mode Delphi}`]], `-Mdelphi` 或 `-Sd`)
26+- [[Delphi]] ([[Mode Delphi|{$mode Delphi}]], `-Mdelphi` 或 `-Sd`)
2427
25- 这是 Delphi 兼容模式。
28+
29+这是 Delphi 兼容模式。
2630
27- * Delphi with Unicode (`{$mode DelphiUnicode}`, `-MdelphiUnicode`) [自 FPC 3.0.0 起]
31+- Delphi with Unicode (`{$mode DelphiUnicode}`, `-MdelphiUnicode`) \[自 FPC 3.0.0 起\]
2832
29- 与 `{$mode Delphi}` 类似,但默认 `string` 类型是 `unicodeString`。
33+
34+与 `{$mode Delphi}` 类似,但默认 `string` 类型是 `unicodeString`。
3035
31- * [[Mac Pascal]] ([[Mode MacPas|`{$mode MacPas}`]], `-MmacPas`) [since FPC 1.9.0]
36+- [[Mac Pascal]] ([[Mode MacPas|{$mode MacPas}]], `-MmacPas`) \[since FPC 1.9.0\]
3237
33- Mac Pascal 兼容模式。
38+
39+Mac Pascal 兼容模式。
3440
35- * [[GNU Pascal]] ([[Mode GPC|`{$mode GPC}`]], `-MGPC` 或 `-Sp`) [removed since FPC 2.2.0]
41+- [[GNU Pascal]] ([[Mode GPC|{$mode GPC}]], `-MGPC` 或 `-Sp`) \[removed since FPC 2.2.0\]
3642
37- GNU Pascal 兼容模式。
43+
44+GNU Pascal 兼容模式。
3845
39- * ISO 7185 [[Standard Pascal]] ([[Mode iso|`{$mode ISO}`]], `-MISO`) [[FPC New Features 2.6.0|[since FPC 2.6.0]]]
46+- ISO 7185 [[Standard Pascal]] ([[Mode iso|{$mode ISO}]], `-MISO`) \[[[FPC New Features 2.6.0|since FPC 2.6.0]]\]
4047
41- 符合 ISO 7185 标准的兼容模式。
48+
49+符合 ISO 7185 标准的兼容模式。
4250
43- * [[Extended Pascal]] ([[Mode extendedpascal|`{$mode extendedPascal}`]]) [since FPC 3.2]
51+- [[Extended Pascal]] ([[Mode extendedpascal|{$mode extendedPascal}]]) \[since FPC 3.2\]
4452
45- 这是扩展 Pascal 模式。它尽可能符合 ISO 10206 标准。
53+
54+这是扩展 Pascal 模式。它尽可能符合 ISO 10206 标准。
4655
47-此外,特殊模式 `default` 会恢复任何指定的编译器兼容模式。
56+此外,特殊模式 `default` 会恢复任何指定的编译器兼容模式。
4857
49-由于编译器兼容模式的指定隐含地施加了严格的变化,并且可能意味着包含其他模块,因此必须在其他任何内容之前指定这些指令。
58+由于编译器兼容模式的指定隐含地施加了严格的变化,并且可能意味着包含其他模块,因此必须在其他任何内容之前指定这些指令。
5059
5160## 模式开关 mode switch
5261
53-自 FPC 2.3.1 起,全局编译器指令 [[modeswitches|`{$modeSwitch}`]] 允许在选择模式后选择性地启用或禁用某些特性。
62+自 FPC 2.3.1 起,全局编译器指令 [[modeswitches|{$modeSwitch}]] 允许在选择模式后选择性地启用或禁用某些特性。
5463
55-模式开关必须出现在任何模式选择之后,否则模式开关将被覆盖。
56-```
64+模式开关必须出现在任何模式选择之后,否则模式开关将被覆盖。
65+
66+``` pascal
5767// 尽管选择了 FPC 模式,但在将过程变量赋值时省略 @ 地址运算符
58- {$mode FPC}
59- {$modeSwitch classicProcVars+} // 在 FPC 模式下,为过程变量赋值时省略 @ 地址运算符
68+{$mode FPC}
69+{$modeSwitch classicProcVars+} // 在 FPC 模式下,为过程变量赋值时省略 @ 地址运算符
6070```
6171
6272## 另请参阅
6373
64- * [_Free Pascal 用户手册_ 中的“编译器模式”部分](<https://www.freepascal.org/docs-html/user/userse33.html>)
74+- [*Free Pascal 用户手册*中的“编译器模式”部分](https://www.freepascal.org/docs-html/user/userse33.html)
6575
6676---
67-*From the Free Pascal wiki, page "Compiler Mode/zh CN", as the Internet Archive kept it on 2025-01-18. 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).*
77+*From the Free Pascal wiki, page "Compiler Mode/zh CN", as it stood on 2024-05-03 after a change by Hieroly, 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).*
78+Category: Compiler Mode/zh CN

Back to history