On 2024-07-25 09:39, Alejandro Colomar wrote:
So, we have arrived there, tmp is 1, and the suffix is "k", so it will be multiplied by 1000.
That's the expected behavior.
I passed a base of -1.
Fine, so don't do that. When you use base -1, it doesn't matter whether the behavior differs on platform A vs B. Portable code can't use base -1 with strtol; we'll get unspecified or even undefined behavior. It's OK if xstrtol also has unspecified or even undefined behavior when the base is -1.
Again, none of this matters in actual software that uses xstrtol. Let's move on to a different topic.