Hey guys
Hey guys,
I'm here again with many problems to share with you :D
Is there any compiler directive to make local variables starting with its default type value?
It is a bit strange, looking at the code below:
function TQueue.Contains(const Item: T): Boolean;
var
LCount: Int32;
LIndex: Int32;
begin
Result := False; <- I would expect this is not necessary, once Result would start with its default type value that is False, but if I don't do this, the code doesn't work properly, and all sort of weird things happens.
LIndex := FHead;
LCount := FCount;
for LCount := FCount downto 1 do
begin
if FComparer.Equals(FItems[LIndex], Item) then
begin
Result := True;
Break;
end;
LIndex := (LIndex + 1) mod Length(FItems);
end;
end;
On Windows platform, I can remove the line commented, but running on Android it is not a good idea :(
Have I misunderstood something?
:D
I'm here again with many problems to share with you :D
Is there any compiler directive to make local variables starting with its default type value?
It is a bit strange, looking at the code below:
function TQueue
var
LCount: Int32;
LIndex: Int32;
begin
Result := False; <- I would expect this is not necessary, once Result would start with its default type value that is False, but if I don't do this, the code doesn't work properly, and all sort of weird things happens.
LIndex := FHead;
LCount := FCount;
for LCount := FCount downto 1 do
begin
if FComparer.Equals(FItems[LIndex], Item) then
begin
Result := True;
Break;
end;
LIndex := (LIndex + 1) mod Length(FItems);
end;
end;
On Windows platform, I can remove the line commented, but running on Android it is not a good idea :(
Have I misunderstood something?
:D
Comments
Post a Comment