Something I wasn't entirely aware of before taking to moving to a new server is that apparently some functions of C change based on which machine you compile your code on. Strerror_r is apparently one of them, as according to this page the function will return an integer if compiled on a machine where _XOPEN_SOURCE of 600 or higher is defined, or it will return a char string pointer if that isn't defined or defined at a lower value. Considering that the function I wrote that uses strerror_r previously worked on the integer return version, I can only assume that my current host does not have said value defined as the function is now complaining about being broken due to character pointer to integer problems.
So I'm curious. How often do these sort of C compatibility issues come up? Ideally, I want the codebase I'm writing to work with as little machine-based modification for a user as possible (where linux machines are concerned, anyways). I just wasn't expecting that I'd have to start writing multiple/variant sections of code and functions to suit the environment of a particular machine; i.e, have macro sections set up to check for particular values and compile one version or another depending on the result.
Additionally, I'm wondering if anyone has a thought for other methods by which this could be resolved; i.e, force the compiler to provide the integer-return version of strerror_r. I figured that defining _XOPEN_SOURCE at 600 would do the trick (via -D_XOPEN_SOURCE=600 in the makefile), and while that does switch the function to the correct type, it just about breaks everything else.
Edit: I should note that the problem with the function using strerror_r itself is currently resolved, due to using a macro section that checks against the existence and value of _XOPEN_SOURCE, but I'm still curious to hear other information and solutions and whatnot on the topics above.
I've run into compatibility issues with default signing of characters, 32 vs 64 bits, and occasional differences in availability of functions based on the standard libraries present. I've never run into the one you mentioned, though.