#9 Problem with 64-bit systems

closed-fixed
Chuck Byam
Misc (8)
5
2003-05-13
2002-12-17
Anonymous
No

The split() function in utils.cpp extracts tokens from the
input string until it reaches the end of the string. To
determine when it's reached the end of the string, it
watches the result of find_first_not_of(), and exits the
loop when its value is equal to the constant string::npos.

On a 64-bit DEC Alpha, string::npos is a 64-bit integer,
but the variable 'start' used to hold the result of
find_first_not_of() is of type unsigned and truncates the
value, causing the comparison to fail. The end result is
that the program dies as soon as it tries to process
INIT.TNC.

Truncating string::npos to 32 bits in the comparison
seemed to fix the problem for me:

while((start != (string::npos & 0xffffffff)) && (wordcount
< saSize))

Discussion

  • Scott Miller
    Scott Miller
    2003-03-12

    Logged In: YES
    user_id=700874

    Ok, found a better fix for this: Just change the line 'unsigned
    start,end;' to 'unsigned long start,end;' and it works beautifully.

     
  • Chuck Byam
    Chuck Byam
    2003-04-20

    • assigned_to: nobody --> kg4ijb
    • status: open --> open-accepted
     
  • Chuck Byam
    Chuck Byam
    2003-05-13

    • status: open-accepted --> closed-fixed
     
  • Chuck Byam
    Chuck Byam
    2003-05-13

    Logged In: YES
    user_id=179062

    Thanks, committed