Integer handling Error
Jean Huveneers
Geulle, The Netherlands
Hi,
i just found a error in the following code:
<== fs_itools ==>
function ParserStringToVariant(const s: String): Variant;
var
i, k: Integer;
OldDS: Char;
begin
Result := Null;
if s <> '' then
if s[1] = '''' then
Result := Copy(s, 2, Length(s) - 2)
else
begin
Val(s, i, k);
if k = 0 then
Result := i
else
begin
<== fs_itools ==>
When Assigning -2147483648 to an integer, k=11 because 2147483648 is not a valid integer value (maxint=2147483647). This is cause by handling the '-' seperated. Anybody got an idea how fix this? I need this very badly.
Regards,
Jean
i just found a error in the following code:
<== fs_itools ==>
function ParserStringToVariant(const s: String): Variant;
var
i, k: Integer;
OldDS: Char;
begin
Result := Null;
if s <> '' then
if s[1] = '''' then
Result := Copy(s, 2, Length(s) - 2)
else
begin
Val(s, i, k);
if k = 0 then
Result := i
else
begin
<== fs_itools ==>
When Assigning -2147483648 to an integer, k=11 because 2147483648 is not a valid integer value (maxint=2147483647). This is cause by handling the '-' seperated. Anybody got an idea how fix this? I need this very badly.
Regards,
Jean
Comments
instead of "-2147483648" use "-(2147483647 + 1)"
tnx!