Subsections

- 1 FPC mode
- 2 TP mode
- 3 Delphi mode
- 4 GPC mode
- 5 OBJFPC mode

#
D. Compiler modes

Here we list the exact effect of the different compiler modes. They can be set with the `$Mode` switch, or by command line switches.

# 1 FPC mode

This mode is selected by the `$MODE FPC` switch. On the command-line, this means that you use none of the other compatibility mode switches. It is the default mode of the compiler. This means essentially:

1. You must use the address operator to assign procedural variables.
2. A forward declaration must be repeated exactly the same by the implementation of a function/procedure. In particular, you can not omit the parameters when implementing the function or procedure.
3. Overloading of functions is allowed.
4. Nested comments are allowed.
5. The Objpas unit is NOT loaded.
6. You can use the cvar type.
7. PChars are converted to strings automatically.

# 2 TP mode

This mode is selected by the `$MODE TP` switch. On the command-line, this mode is selected by the `-So` switch.

1. Enumeration sizes default to a storage size of 1 byte if there are less than 257 elements.
2. You cannot use the address operator to assign procedural variables.
3. A forward declaration must not be repeated exactly the same by the implementation of a function/procedure. In particular, you can omit the parameters when implementing the function or procedure.
4. Overloading of functions is not allowed.
5. The Objpas unit is NOT loaded.
6. Nested comments are not allowed.
7. You can not use the cvar type.

# 3 Delphi mode

This mode is selected by the `$MODE DELPHI` switch. On the command-line, this mode is selected by the `-Sd` switch.

1. You can not use the address operator to assign procedural variables.
2. A forward declaration must not be repeated exactly the same by the implementation of a function/procedure. In particular, you not omit the parameters when implementing the function or procedure.
3. Overloading of functions is not allowed.
4. Nested comments are not allowed.
5. The Objpas unit is loaded right after the system unit. One of the consequences of this is that the type `Integer` is redefined as `Longint`.

# 4 GPC mode

This mode is selected by the `$MODE GPC` switch. On the command-line, this mode is selected by the `-Sp` switch.

1. You must use the address operator to assign procedural variables.
2. A forward declaration must not be repeated exactly the same by the implementation of a function/procedure. In particular, you can omit the parameters when implementing the function or procedure.
3. Overloading of functions is not allowed.
4. The Objpas unit is NOT loaded.
5. Nested comments are not allowed.
6. You can not use the cvar type.

# 5 OBJFPC mode

This mode is selected by the `$MODE OBJFPC` switch. On the command-line, this mode is selected by the `-S2` switch.

1. You must use the address operator to assign procedural variables.
2. A forward declaration must be repeated exactly the same by the implementation of a function/procedure. In particular, you can not omit the parameters when implementing the function or procedure.
3. Overloading of functions is allowed.
4. Nested comments are allowed.
5. The Objpas unit is loaded right after the system unit. One of the consequences of this is that the type `Integer` is redefined as `Longint`.
6. You can use the cvar type.
7. PChars are converted to strings automatically.