Sign in Join
Wiki copytemporary

Mode iso: what changed

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

OldNewLine
11[[FPC]]’s [[Compiler Mode|compatibility mode]] **`{$mode ISO}`** *intends* to comply with the requirements of level 0 and 1 of the ISO/IEC standard 7185. It became available in [[FPC New Features 2.6.0|version 2.6.0]]. The International Organization for Standardization standard 7185 is also known as [[Standard Pascal|Standard “Unextended” Pascal]].
22
33## Notable differences
44
55This list highlights differences to the standard [[Mode FPC|{$mode FPC}]] compiler compatibility mode.
66
77- `{$modeSwitch ISOProgramParas+}`: The [[Program|program]] parameter list becomes significant. If not enabled via the `‑MISO` command-line switch, you will need to place `{$mode ISO}` *before* the `program` header.
88- `{$modeSwitch ISOIO+}`: Files have associated “buffer variables” and [[Get|get]] and [[Put|put]] can operate on them. This functionality is not present in other modes.
99- `{$modeSwitch ISOUnaryMinus+}`: A unary [[Minus|minus]] has the same [[Operator|operator precedence]] as other addition operators. Usually *all* unary operators have the highest precedence.
1010- `{$modeSwitch ISOMod+}`: The [[Mod|mod operator]] yields a positive result (Euclidean-like definition).
1111- `{$modeSwitch nonLocalGoto+}`: You can [[Goto|goto]] labels anywhere in the program.
1212- `{$modeSwitch nestedProcVars+}`: Procedural variables may assume addresses of nested [[Routine|routine]] definitions.
1313- Support for routine parameters and `{$modeSwitch classicProcVars+}` (i. e. no special syntax requirements to differentiate between routine activation and designation):
1414
1515program routineParameter(output);
1616
1717procedure fancyPrint(function f: integer); begin
1818
1919`   writeLn('❧ ', f:1, ' ☙')`
2020
2121end;
2222
2323function getRandom: integer; begin
2424
2525`   { chosen by fair dice roll: guaranteed to be random }`\
2626`   getRandom := 4`
2727
2828end;
2929
3030begin
3131
3232`   fancyPrint(getRandom);`
3333
3434end.
3535
36-</syntaxhighlight>
37-
3836## Status
3937
4038- As of version 3.2.0 the FPC does not yet support conformant-array parameters, thus level 1 requirements are not met, [FPC issue 38632](https://gitlab.com/freepascal.org/fpc/source/-/issues/38632).
4139- It is not possible to mix block-comment delimiters. `{ }` and `(* *)` cannot be mixed although the standard specifically states so.
4240
4341## Notes
4442
4543- The mode’s intention is to *at least* compile an ISO-compliant `program` [[Source code|source code]] file. The FPC will be able to compile a *superset* of programs.
4644 - For instance, ISO standard 7185 defines a *fixed order* of sections, [[Const|const]] → [[Type|type]] → [[Var|var]], but the FPC accepts *any* order, cf. [FPC issue 37739](https://gitlab.com/freepascal.org/fpc/source/-/issues/37739).
4745 - Delphi-style [[Comments|// end-of-line comments]] are accepted.
4846 - Or the mere fact that procedural *variables* are allowed should be surprising enough.
4947
5048
5149It is quite possible that a *different* compiler rejects the same source code on grounds of non-compliance. Unlike the [[GNU Pascal]] Compiler there is no way to disable such “extensions”.
5250
5351- The value of the constant [[maxint|maxInt]] is not necessarily identical to `high(ALUSInt)`. The permissible range of values of the [[Integer|integer]] data type still depends on the mode.
5452
5553---
5654*From the Free Pascal wiki, page "Mode iso", as it stood on 2022-01-21 after a change by Alextp, 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