Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/VCL/Core VCL Classes    [ Add a report in this area ]  
Report #:  53739   Status: Open
Inline GetCurrent and MoveNext in all RTL and VCL enumerators
Project:  Delphi Build #:  11.0.2799.9201
Version:    11.1 Submitted By:   Hallvard Vassbotn
Report Type:  Suggestion / Enhancement Request Date Reported:  10/20/2007 12:57:49 AM
Severity:    Commonly encountered problem Last Updated: 3/20/2012 2:24:39 AM
Platform:    All versions Internal Tracking #:   256281
Resolution: None (Resolution Comments) Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: 10
Description
As documented here:
http://hallvards.blogspot.com/2007/10/more-fun-with-enumerators.html

the compiler generates more efficient code for enumerators with inlined GetCurrent functions. Provided either QC#53623 or QC#53737 are fixed, inlined MoveNext functions will generate even more efficient code.
Steps to Reproduce:
Change all RTL and VCL enumerators like:

  TListEnumerator = class // or record - see QC#53738
  private
    FIndex: Integer;
    FList: TList;
  public
    constructor Create(AList: TList);
    function GetCurrent: Pointer;
    function MoveNext: Boolean;
    property Current: Pointer read GetCurrent;
  end;

to:

  TListEnumerator = class // or record - see QC#53738
  private
    FIndex: Integer;
    FList: TList;
  public
    constructor Create(AList: TList);
    function GetCurrent: Pointer; inline;
    function MoveNext: Boolean; inline;
    property Current: Pointer read GetCurrent;
  end;

This applies to a number of enumerator classes:

TActionListEnumerator = class
TTreeNodesEnumerator = class
TListItemsEnumerator = class
TToolBarEnumerator = class
TFavoriteLinkItemsEnumerator = class
TTaskDialogButtonsEnumerator = class
TMenuItemEnumerator = class
TFieldsEnumerator = class
TListEnumerator = class
TInterfaceListEnumerator = class
TCollectionEnumerator = class
TStringsEnumerator = class
TComponentEnumerator = class
TWideStringsEnumerator = class
Workarounds
None
Attachment
None
Comments

None

Server Response from: ETNACODE01