Autor Beitrag
Moritz M.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1672



BeitragVerfasst: Fr 17.01.03 14:59 
Hi

Ich bekomm vom Compiler folgende Warnungen:
ausblenden Quelltext
1:
2:
3:
4:
[Warning] Unit1.pas(165): Combining signed and unsigned types - widened both operands
[Warning] Unit1.pas(167): Combining signed and unsigned types - widened both operands
[Warning] Unit1.pas(169): Combining signed and unsigned types - widened both operands
[Warning] Unit1.pas(171): Combining signed and unsigned types - widened both operands


Was kann ich dagegen tun?

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
function Tprog.UpTime: string;
const
  ticksperday: Integer    = 1000 * 60 * 60 * 24;
  ticksperhour: Integer   = 1000 * 60 * 60;
  ticksperminute: Integer = 1000 * 60;
  tickspersecond: Integer = 1000;
var
  t:          Longword;
  d, h, m, s: Integer;
begin
  t:=GetTickCount;
  d:=t div ticksperday;        //Zeile 165
  Dec(t, d * ticksperday);
  h:=t div ticksperhour;      //Zeile 167
  Dec(t, h * ticksperhour);
  m:=t div ticksperminute;  //Zeile 189
  Dec(t, m * ticksperminute);
  s:=t div tickspersecond;    //Zeile 171
  Result:=IntToStr(d)+' Tage '+IntToStr(h)+' Stunden '+IntToStr(m)+' Minuten '+IntToStr(s)+' Sekunden';
end;
Simon Joker
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 236
Erhaltene Danke: 1



BeitragVerfasst: Fr 17.01.03 15:37 
Hi

du weiset einem LongWord (soweit ich weis vorzeichenlos) einen Integer (Vorzeichen behaftet) zu. Das geht in die Hose, wenn der Negativ ist. Passe einfach deine Variablen an.
Moritz M. Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1672



BeitragVerfasst: Fr 17.01.03 15:39 
Danke, jetzt gehts einwandfrei!