Difference between revisions of "Mode ObjFPC"
From Free Pascal wiki
Jump to navigationJump to searchLine 4: | Line 4: | ||
#The address operator has to be used to assign procedural variables. | #The address operator has to be used to assign procedural variables. | ||
− | #A [[forward]] declaration must be repeated exactly the same by the [[ | + | #A [[Forward|forward]] declaration must be repeated exactly the same by the [[Implementation]] of a [[Function|function]]/[[Procedure|procedure]]. In particular, the parameters cannot be omitted when implementing the function or procedure, and the calling convention must be repeated as well. |
− | #[[Overloading]] of functions is allowed. | + | #[[Overload|Overloading]] of functions is allowed. |
#Nested comments are allowed. | #Nested comments are allowed. | ||
#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]]. | #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]]. | ||
− | #The [[cvar]] type may be used. | + | #The [[Cvar|cvar]] type may be used. |
#[[PChar]]s are converted to [[String|string]]s automatically. | #[[PChar]]s are converted to [[String|string]]s automatically. | ||
#Parameters in class methods cannot have the same names as class properties. | #Parameters in class methods cannot have the same names as class properties. | ||
− | #Strings are [[ | + | #Strings are [[Shortstring]]s by default. This may be changed by using the -Sh command line switch or the {$H+} switch. |
[[Category:Modes]] | [[Category:Modes]] |
Revision as of 19:38, 18 July 2016
The mode ObjFPC, switched on with {$mode objfpc}, is the default mode for Lazarus source files.
Using the ObjFPC mode has the following consequences:
- The address operator has to be used to assign procedural variables.
- A forward declaration must be repeated exactly the same by the Implementation of a function/procedure. In particular, the parameters cannot be omitted when implementing the function or procedure, and the calling convention must be repeated as well.
- Overloading of functions is allowed.
- Nested comments are allowed.
- 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.
- The cvar type may be used.
- PChars are converted to strings automatically.
- Parameters in class methods cannot have the same names as class properties.
- Strings are Shortstrings by default. This may be changed by using the -Sh command line switch or the {$H+} switch.