User Changes 2.2.4
- 1 About this page
- 2 All systems
- 3 All Unix-based systems
- 4 Non-x86 and non-linux/ppc64 systems
- 5 Windows Platforms
About this page
Below you can find a list of intentional changes between the the 2.2.2 release and the 2.2.4 release which can change the behaviour of previously working code, along with why these changes were performed and how you can adapt your code if you are affected by them.
Default property values
- Old behaviour: Published properties without a specified default were not streamed under certain circumstances.
- New behaviour: Such properties are now treated as if they had nodefault specified. This means that some extra properties will now be streamed in such cases:
- Boolean fields with the value false
- Enumerated types with the ordinal value 0
type tenum = (ea,eb,ec); tc = class private fmybool: boolean; fenum: tenum; published property mybool: boolean read fmybool write fmybool; property enum: tenum read fenum write fenum; end; var c: tc; begin c:=tc.create; // write c to a stream end.
In earlier versions, mybool nor enum would be written to the stream in this case, while now they will be.
- Reason: Delphi compatibility.
- Remedy: Explicitly specify default values as follows
type tenum = (ea,eb,ec); tc = class private fmybool: boolean; fenum: tenum; published property mybool: boolean read fmybool write fmybool default false; property enum: tenum read fenum write fenum default ea; end;
db unit: TField*.*Size type
- Old behaviour: TFieldDef.Size, TField.Size and TField.DataSize were defined as word.
- New behaviour: TFieldDef.Size, TField.Size and TField.DataSize are defined as integers. This also means that definition of the corresponding methods has changed.
- Example: The following definitions of methods have been changed:
- constructor TFieldDef.Create(AOwner: TFieldDefs; const AName: string; ADataType: TFieldType; ASize: Integer; ARequired: Boolean; AFieldNo: Longint)
- procedure TFieldDef.SetSize(const AValue: integer);
- function TField.GetDataSize: integer;
- procedure TField.SetSize(AValue: integer);
- Reason: Delphi compatibility.
- Remedy: Change the definition of these properties in your methods that override one of the methods above from word to integer.
db unit: TField*.Lookup property is not published anymore
- Old behaviour: TField.Lookup was published, so it was streamed if it was set to True (i.e. for a fkLookup field)
- New behaviour: TField.Lookup is not published anymore, so if you try to read back its streamed value (e.g., loading Lazarus forms) it will fail.
- Reason: The value of this property was also modified by setting FieldKind, which is also streamed. See Bug 12809
- Remedy: If you use Lazarus, remove references to Lookup properties in your project's lfm files.
All Unix-based systems
Executing external programs using TProcess
- Old behaviour: When TProcess was used to execute a program and no explicit path to the executable was given, TProcess searched for the executable in the current directory, and only if it was not found there it looked in the system path.
- New behaviour: On all Unix-based systems, TProcess will not search for the executable in the current directory anymore, unless the current directory is in the system path.
- Example: When you use TProcess to execute 'ls' and there is an 'ls' executable in both the current directory and in '/bin/', then programs compiled with FPC 2.2.2 will execute './ls' (thus in the current directory). Programs compiled with FPC 2.2.4 will run '/bin/ls' instead.
- Reason: Security. Unix-users don't expect that files in the current directory are executed in favour of those in the system path.
- Remedy: If you really want to execute an executable in the current directory, use './exec-name' as executable name.
Non-x86 and non-linux/ppc64 systems
Floating point rounding
- Old behaviour: On these platforms, the round() function always rounded to the nearest integer, halfway away from zero.
- New behaviour: By default, round() now performs banker's rounding (round-to-nearest, halfway to even). If the rounding mode is changed using the Math unit's SetRoundMode() function, the round() function now honours this change.
begin write(round(-2.5),' '); write(round(-1.5),' '); write(round(-0.5),' '); write(round(0.5),' '); write(round(1.5),' '); writeln(round(2.5)); end.
The above program used to print:
-3 -2 -1 1 2 3
Now it will print:
-2 -2 0 0 2 2
- Reason: Compatibility with TP/Delphi.
- Remedy: If you want to use other kinds of rounding, you can change the rounding mode using Math.SetRoundMode(), or use John Herbster's unit attached to bug report 12687.
Functions removed from the Windows unit
- Old behaviour: The following functions were declared in the Windows unit (including A and W variants where applicable):
- comctl32.dll (and some helper routines):
- New behaviour: These function have been removed from the Windows unit.
- Reason: Delphi compatibility, remove definitions of functions also declared in the commdlg and commctrl units.
- Remedy: Add the commdlg and/or commctrl unit(s) to your uses clause.