Java ‘long’ to C++ ‘int64_t’


For the last two weeks I’ve had an intermittent problem with my C++ version of the crypto socket client, and tonight I finally cracked the issue.

The Java version is using ‘long’ for doing it’s calculations and the C++ version was using a 64 bit integer, which should have been fine until tonight I realised that Java was using its ‘long’ values as signed. Whereas I had been using ‘uint64_t’ in the C++ version.

This caused the C++ version to work once in every 5 to 10 tries. Just by removing the unsigned, it now works flawlessly.

Phew! Now I can blitz the rest…

(Yep, it has been a while since the last post)

Posted in C++, Java.