[lazarus] Patch win32: 'as' usage
M.Nelissen at student.tue.nl
Sun Aug 31 10:29:03 EDT 2003
Mattias Gaertner wrote:
> On Sun, 31 Aug 2003 15:47:42 +0200
> Micha Nelissen <M.Nelissen at student.tue.nl> wrote:
>>Attached patch greatly reduces the usage of the 'as' operator. Goal was
>>to keep current functionality: only changes are made to those statements
>>where the type was already verified before, either by 'is' or another
>>Question: what assumptions can we make about function entry? Then we can
>>further reduce usage of as.
>>1) Can we assume Sender parameter is of type as FCompStyle indicates?
>>Ie. csButton is a TButton?
>>2) Can we assume basic class like TWinControl? Some function seem to
>>assume it by starting with an 'as' right at the beginning of the
>>function. It may be an idea to change 'Sender: TObject' to 'Sender:
>>TWinControl' if this is the case.
> Yes, for most functions. There are some exceptions: dialog's and menu's base
> class is only TComponent.
> Also consider that replacing an 'as' operator, that is not in a loop, will
> not get any measurable acceleration and you will loose an extra consistency
OK, I have made a new patch using assumption #1. Please apply it. I
haven't removed all 'as' usage: still half of them are there. It just
seems very paranoid to use so much 'as'.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 5074 bytes
Url : http://localhost/pipermail/lazarus/attachments/20030831/0b433401/bin00065.bin
More information about the Lazarus