Can a subroutine return a 64-bit integer?

May 20, 2008
11,400
99
Syracuse, NY, USA
In the RETURN command from a GOSUB? I think that's the same thing as an exit code or %ERRORLEVEL% -- a 32-bit integer.
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.
 

rconn

Administrator
Staff member
May 14, 2008
12,344
149
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).
 
May 20, 2008
11,400
99
Syracuse, NY, USA
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).
Yup, that's what I did.
 
Similar threads
Thread starter Title Forum Replies Date
vefatica Is EOF an implied RETURN? Support 3
Joe Caverly Why does TCCRT return VIEW as an internal command? Support 6
D Can the argument to RETURN be a function expansion? Support 3
A Inconsistent return code for TCC scripts Support 4
J How to? Speedup of gosub/return Support 8
S Return of FTP copy bug in 16.02.48 Support 12
M How to? Get the return code from an external program... Support 8
A WAD function return values with parentheses prevent evaluation of additional functions Support 31
Stefano Piccardi How to? return values from @python Support 2
A How to? return to completion mask after auto-completion Support 14
ehab aboudaya How to? 2 GUI questions and return HWND using TakeCommandIPC Support 3
M echo %@index[1234,.,-1] return -21 in new version Support 3
Jay Sage Function to Return Selected Text Support 2
rconn Do NOT request return receipt! Support 7
rconn No return receipt!! Support 10
Peter Murschall Single-line Do-CMD is a bit uncooperative. Support 6
Joe Caverly VBEEP on 64-bit Support 3
vefatica SETP usually fails with a 32 bit process Support 4
rconn Dropping 32-bit support in Take Command & TCC? Support 14
dcantor How to? Can 32-bit TCC be run on a system with 64-bit TCMD and TCC installed? Support 6
T 32 and 64 bit simultaneous portable versions Support 2
vefatica Make FFIND a bit more friendly? Support 14
CWBillow Everything.exe - 64-bit? Support 8
S 32-bit Take Command v22 install for thumb drive Support 1
Per TCC/LE 14 64-bit won't start on Windows 10 Insider Preview 17063 (171213) Support 12
Joe Caverly SETP and 32-bit process Support 2
gworley How to? Take Command 20 64 bit vs 32 bit Support 1
mikea Documentation Consider expanding the docs for 'Everything' a bit Support 10
T 64 bit TCCLE appears to crash when opening tcc.exe from within tcc.exe window Support 7
M 64-bit plugins? Support 1
M An oddity that's a little bit scary... Support 6
rconn News Take Command 16.03.54 32-bit installer Support 0
rconn News Take Command 16.03.54 32-bit installer fix Support 0
MickeyF problem using COM object in VBScript from v16 x64 TCC but not from v15 32-bit TCC Support 4
JohnQSmith Installing TCMD16 on 32 bit XP Support 12
D New 64-bit install goes to Program Files x86 Support 3
F How to install 64-bit after having installed 32-bit on Win7 Support 2
Dan Glynhampton Bad link to 64 bit RC1 download Support 0
M And oddity re the 32-bit TCC on a 64-bit system... Support 4
C Advantages of 32 or 64 bit TCMD in 64 bit Windows 7 Support 3
C How to determine if system is 32 or 64 bit? Support 5
M How to? Identify 64-bit and 32-bit TCC sessions... Support 7
M WAD A bit of strangeness related to Unicode-marked file not being Unicode Support 2
M A bit of a complaint regarding @FileDate and @FileTime Support 3
K_Meinhard Take Command v13 64-bit Support 9
K_Meinhard 64-bit installer Support 3
M Another bit of weirdness.... Support 0
M A little bit of strangeness with @Char... Support 3
J CTRL-C does not work on Windows 7 64-bit Support 3
S Take Command LE (32 bit) locking up several times a day Support 14

Similar threads