4 ms·
Not at all. You wrap it in an ifdef macro by platform.
by hossbeast 8y ago
Not at all. You wrap it in an ifdef macro by platform.
- Annatar 8y agoThat’s a solution of last resort, when all else has failed, an act of desperation: whosoever does that is saying: “I don’t know how to express this in a generic fashion”, or “it’s too much work to do it that way and I don’t want to deal with it”. Since the very reason we get paid as programmers is to deal with it, I argue that such an act constitutes a breach of grounds on which we are being paid.
- Mikhail_Edoshin 8y agoBy 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.