Sunday | 23 JUN 2024
[ previous ]
[ next ]

Magic Numbers -9223372036854775808

Date: 2022-02-09

While working on my node addon I ran into a weird issue where I was able get the correct data from universe from ubuntu on my home pc but I was getting a magic number on the work server. I originally thought it was a problem with compilation and so I installed the same version of gcc and tried to see if that was the issue. It didn't seem to matter and I figured out that the error was strictly just the error code and that the data was fine. I had a feeling it was probably something to do with with overflow and googled the number and found a stackoverflow answer.

The answer points out that this number appears when you overflow int64_t which I wasn't using but I was using a double. I double checked and found that universe's ic_subcall actually returns a long which is where the issue came from. I'm guessing that double on ubuntu acts similar to a long vs on rhel. Changing my type to long fixed the issue!

Isn't this fun!

2022-02-10 - I lied, the number is magic but my problem isn't with long vs double as I thought, I'm not sure what it is but flipping the types doesn't fix the issue and so for now I've just removed the check so I assume everything is always successful. The power of delusion!