1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Can a subroutine return a 64-bit integer?

Discussion in 'Support' started by vefatica, Aug 23, 2014.

  1. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,971
    Likes Received:
    30
    Apparently not.
     
  2. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,312
    Likes Received:
    39
    In the RETURN command from a GOSUB? I think that's the same thing as an exit code or %ERRORLEVEL% -- a 32-bit integer.
     
  3. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,971
    Likes Received:
    30
    Yeah! I found out the hard way. I have a subroutine to compute multinomial coefficients and started getting screwy results when the numbers got big.
     
  4. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,870
    Likes Received:
    83
    ERRORLEVEL is 32-bit because (1) nobody has ever (until now!) needed more, and (2) 64-bit returns would break CMD compatibility.

    But there's no reason you have to pass it back through RETURN or ERRORLEVEL; you could as easily put it in an environment variable (and have more bits than you could ever use).
     
  5. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,971
    Likes Received:
    30
    Yup, that's what I did.
     

Share This Page