4 ms·
And for INT_MIN? The c-faq (http://c-faq.com/misc/sd26.html http://c-faq.com/misc/sd26.html) says that this approach fails in that case. Is your suggestion to j
by apgwoz 15y ago
And for INT_MIN? The c-faq (http://c-faq.com/misc/sd26.html http://c-faq.com/misc/sd26.html) says that this approach fails in that case. Is your suggestion to just avoid INT_MIN? If so, that works. :)
- JoachimSchipper 15y agoTo be honest, my suggestion is to avoid signed integers, or at least negative signed integers (beyond perhaps -1 for signalling errors). I find that I almost never need them, and unsigned integers are much nicer to work with.
- apgwoz 15y agoThat's an interesting perspective, and one that probably works out in practice most of the time. Integration with other libs is the place I'm thinking where it doesn't, but it seems simple, and rather trivial in many cases to do the conversion to signed integers before making the library call. Of course, if you're taking advantage of the extra positive values and need a signed int, I think you're shit out of luck.