Hello,
I have a strange optimization bug and I wonder wy, also I wonder if
there are similar optimizations in Delphi that I need to know of. I
explain with a peace of code:
if Foo.CheckForChanges then
Foo.SaveToFile;
procedure TFoo.CheckForChanges: boolean;
var
n: integer;
begin
Result := False;
for n := 0 to Count - 1 do
Result := Result or CheckAccount(Items[n]);
end;
What happens here is that as soon as 1 CheckAccount returns True then it
stop calling CheckAccount. I solved this with increment a counter for
each CheckAccount and Result := Counter > 0; But this kind of
optimization is for me a bug, or is it not ? I discoverd this in D7,
dont know about previous D versions, however I'm pretty sure I did
similar things in other projects.
---
Rgds, Wilfried
http://www.mestdagh.biz
__________________________________________________
Delphi-Talk mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi-talk