RunErr

Avra
Schreiberling
Avatar
Geschlecht:
Herkunft: Belgrade, Serbia
Alter: 54
Homepage: rs.linkedin.com/in…
Beiträge: 653
Dabei seit: 07 / 2002
Betreff:

RunErr

 · 
Gepostet: 04.09.2014 - 15:03 Uhr  ·  #1
RunErr for w := StrToInt('1234567') is false, and RunErr for w := StrToInt('-1') is false when w is word. Is this correct behavior? Do I have to make much more checking then originally thought?

Code
var
  s: string[10];
  w: word;
  b: boolean;
begin
  s := '123';
  w := StrToInt(s); // $007B
  b := RunErr;      // false (expected result)

  s := '1234567';
  w := StrToInt(s); // $D687    (conversion to long is $12D678)
  b := RunErr;      // false    (unexpected result) <<<<<<<<<<

  s := ' 1234';
  w := StrToInt(s); // $0000
  b := RunErr;      // true     (expected result)

  s := '-1';
  w := StrToInt(s); // $FFFF
  b := RunErr;      // false    (unexpected result) <<<<<<<<<<
end;
Gewählte Zitate für Mehrfachzitierung:   0

Registrierte in diesem Topic

Aktuell kein registrierter in diesem Bereich

Die Statistik zeigt, wer in den letzten 5 Minuten online war. Erneuerung alle 90 Sekunden.
MySQL Queries: 15 · Cache Hits: 14   32   46 · Page-Gen-Time: 0.028008s · Speichernutzung: 2 MB · GZIP: ein · Viewport: SMXL-HiDPI