Article View: pl.comp.lang.delphi
Article #334818Re: E2032 For loop control variable must have ordinal type
From: Piotr Rezmer
Date: Mon, 16 Jan 2012 15:58
Date: Mon, 16 Jan 2012 15:58
43 lines
2102 bytes
2102 bytes
R.e.m.e.K pisze:
> Dnia Mon, 16 Jan 2012 16:14:32 +0100, jh napisał(a):
>
>> TPhraseList<Integer, T> = class(TObjectDictionary<Integer, T>)
>> private
>> procedure DoParsePacketList(AStrings: TStringList);
>> end;
>>
>> Podpowie ktoś, skąd taki błąd?
>
> To chyba blad w generykach, bo gdy zmienna steruja petli jest typu byte lub
> word to sie kompiluje, tylko integer jest "zablokowany" a jego uzywasz w
> generyku. Jak sie Twojego generyka zamieni z<Integer, T> na np.<byte, T>
> to juz petla oparta o Integer biega.
>
Można też się uprzeć na:
type
Int = Integer;
TPhraseList<Int, T> = class(TObjectDictionary<Int, T>)
private
procedure DoParsePacketList(AStrings: TStringList);
end;
implementation
procedure TPhraseList<Int, T>.DoParsePacketList(AStrings: TStringList);
var
k: Integer;
s : string;
begin
if Assigned(AStrings) then
begin
Self.Clear;
for k := 0 to AStrings.Count -1 do;//linia 212
end;
end;
--
pozdrawiam
Piotr
XLR250&bmw_f650_dakar
Technical Details
Message-ID:
<jf1hf9$4tt$1@inews.gazeta.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!not-for-mailReferences:
<jf1eso$r2g$1@inews.gazeta.pl> <1br6f6z112z73$.dlg@hell.heaven>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!not-for-mail From: Piotr Rezmer <piotr.rezmer_bez_spamu@ens.net.pl> Newsgroups: pl.comp.lang.delphi Subject: Re: E2032 For loop control variable must have ordinal type Date: Mon, 16 Jan 2012 16:58:08 +0100 Organization: "Portal Gazeta.pl -> http://www.gazeta.pl" Lines: 43 Message-ID: <jf1hf9$4tt$1@inews.gazeta.pl> References: <jf1eso$r2g$1@inews.gazeta.pl> <1br6f6z112z73$.dlg@hell.heaven> NNTP-Posting-Host: 77-252-224-134.ip.netia.com.pl Mime-Version: 1.0 X-Trace: inews.gazeta.pl 1326729513 5053 77.252.224.134 (16 Jan 2012 15:58:33 GMT) X-Complaints-To: usenet@agora.pl NNTP-Posting-Date: Mon, 16 Jan 2012 15:58:33 +0000 (UTC) X-User: prezmer X-Antivirus: avast! (VPS 120116-0, 2012-01-16), Outbound message In-Reply-To: <1br6f6z112z73$.dlg@hell.heaven> X-Antivirus-Status: Clean User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; pl; rv:1.9.1.16) Gecko/20101125 Thunderbird/3.0.11 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit