Integer handling Error

Jean HuveneersJean Huveneers Geulle, The Netherlands
edited 1:32PM in FastScript
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

Comments

  • Jean HuveneersJean Huveneers Geulle, The Netherlands
    edited January 2004
    I Recieved a work-around from Alexander Tzyganenko:

    instead of "-2147483648" use "-(2147483647 + 1)"

    tnx!

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.