3 ms·
By generically you mean "in C"? Sometimes the functionality is there, but there's no way to express it in C. Integer overflows are exactly such a case; many pro
by Mikhail_Edoshin 8y ago
By generically you mean "in C"? Sometimes the functionality is there, but there's no way to express it in C. Integer overflows are exactly such a case; many processors provide a built-in overflow detection mechanism, but there's no way to access it in C. (It's not even a special mechanism, it's just the command itself, in assembly you clearly see the overflow.) I'd say that using compiler-specific functions (provided they plug into these processor commands) or assembly is exactly the right way to deal with this issue. Yes, parts of the code will be non-portable, but if they're clearly isolated and marked as machine-specific, then why not? The pros certainly outweigh the cons.
- Annatar 8y agoI had exactly that happen when compiling PowerDNS: the developers relied on a GCC intrinsic, so I had to embark on an epic journey of building and packaging a newer version of GCC. Just to be able to serve DNS answers. That’s just so wrong.