Re:Catching integer overflows in C
by BeeOnRope on Wednesday August 22, 2018 @02:59AM
(#17816884)
A variant of (3) that seems close to ideal is to use conditionally defined functions as suggested, that someone else has already written and generously shared, such as portable-snippets [0]. It has a component specifically to offer cross platform builtins with fallback/emulation on plaforms without direct support.
Re:Catching integer overflows in C
by exDM69 on Wednesday August 22, 2018 @03:06AM
(#17816915)
Thanks for the link, that looks quite useful if compiler portability is needed. It's still more effort than option #2, but quite an acceptable trade-off.
[0] https://github.com/nemequ/portable-snippets