Talk:Kaprekar numbers: Difference between revisions

→‎C++ sample code: 'long' behavior on 64-bit operating systems.
(→‎C++ sample code: 'long' behavior on 64-bit operating systems.)
Line 46:
:That change seems fine since the output goes up pretty high anyway. Does that just mean they used a 64-bit machine? --[[User:Mwn3d|Mwn3d]] 17:17, 14 June 2011 (UTC)
::What 'long' means depends on the compiler, but it's typically defined to be the longest native integer type, while 'long long' is (I think) defined to be 64-bit. Someone correct me if I'm wrong. I'll change the code anyhow, because it overflows with 32 bit long for sure. --[[User:Ledrug|Ledrug]] 17:25, 14 June 2011 (UTC)
::: On every C and C++ compiler I've used on a 64-bit OS (so, GNU on Linux and MSVC/MSVC++ on Windows), 'long' is 32-bits. 'long long' is 64-bits. I don't know about, e.g. SPARC64, though. That's why you get things like uint32_t from stdint.h or DWORD from Windows.h. --[[User:Short Circuit|Michael Mol]] 18:05, 14 June 2011 (UTC)