Difference between revisions of "User Changes 2.2.4"

From Lazarus wiki
Jump to navigationJump to search
Line 6: Line 6:
  
 
=== Default property values ===
 
=== Default property values ===
All published properties that do not have a default specified are treated as if they had nodefault specified,
+
 
as per the Delphi specs. Note that this will cause extra properties to be streamed now, when previously they
+
* '''Old behaviour''': Published properties without a specified ''default'' were not streamed under certain circumstances
were not streamed: False booleans, enumerated types with ordinal value 0.
+
* '''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''
 +
* '''Example''':
 +
<delphi>
 +
type
 +
  tenum = (ea,eb,ec);
 +
  tc = class
 +
  private
 +
    fmybool: boolean;
 +
    fenum: tenum;
 +
  published
 +
    property mybool read fmybool write fmybool;
 +
    property enum read fenum write fenum;
 +
  end;
 +
 
 +
var
 +
  c: tc;
 +
begin
 +
  c:=tc.create;
 +
  // write c to a stream
 +
end.
 +
</delphi>
 +
In earlier versions, ''mybool'' nor ''enum'' would be written to the stream in this case, while now they will be.
 +
* '''Reason''': Delphi compatibility.
 +
* '''Remedy''': Adapt your streaming code to take this change into account.
  
 
=== db unit: TField.GetDataSize return type ===
 
=== db unit: TField.GetDataSize return type ===

Revision as of 17:37, 29 December 2008

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.

All systems

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
  • Example:

<delphi> type

 tenum = (ea,eb,ec);
 tc = class
  private
   fmybool: boolean;
   fenum: tenum;
  published
   property mybool read fmybool write fmybool;
   property enum read fenum write fenum;
 end;

var

 c: tc;

begin

 c:=tc.create;
 // write c to a stream

end. </delphi> In earlier versions, mybool nor enum would be written to the stream in this case, while now they will be.

  • Reason: Delphi compatibility.
  • Remedy: Adapt your streaming code to take this change into account.

db unit: TField.GetDataSize return type