3 ms·
overflow problems, which I try to avoid, start only if its bigger than int. So I had assumed that in my case I'm alright. Do you see any change needed that I c
by rantouan 1y ago
overflow problems, which I try to avoid, start only if its bigger than int.
So I had assumed that in my case I'm alright. Do you see any change needed that I can't see ?
---
Maybe a good idea would had been to go by platform or architecture and use some macros to do the check only if it's really needed. What do you think of it ? How would you implement it ?
You can make a pull request as well.
- deleted 1y ago[deleted]
- eqvinox 1y agoIf strtol reliably sets errno to ERANGE, you're fine (you'll get a compiler warning for "if (aLong < INT_MIN || aLong > INT_MAX) {" though, because it can never be true.) I have no idea what the cross-platform reliability of strtol() is, regarding errno. Should be fine, I hope.