Difference between revisions of "User Changes 2.2.4"

From Lazarus wiki
Jump to navigationJump to search
Line 10: Line 10:
 
* '''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:
 
* '''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''
 
** Boolean fields with the value ''false''
** enumerated types with the ordinal value ''0''
+
** Enumerated types with the ordinal value ''0''
 
* '''Example''':
 
* '''Example''':
 
<delphi>
 
<delphi>
Line 20: Line 20:
 
     fenum: tenum;
 
     fenum: tenum;
 
   published
 
   published
     property mybool read fmybool write fmybool;
+
     property mybool: boolean read fmybool write fmybool;
     property enum read fenum write fenum;
+
     property enum: tenum read fenum write fenum;
 
   end;
 
   end;
  

Revision as of 17:52, 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: 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. </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