I.e. "best practice" code snippets that are known to yield efficient machine code with most modern compilers.
-
-
-
This would be a useful resource but I don't know one. Might write a basic one.
End of conversation
New conversation -
-
-
That example isn't UB, it's implementation-defined and pretty much universally accepted as appropriate.
-
But anyway, x>INT_MAX ? -1-(int)(-1-x) : x
- Show replies
New conversation -
-
-
Ask
@johnregehr ? He might know.Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
CERT C coding std has some examples: https://www.securecoding.cert.org/confluence/display/c/SEI+CERT+C+Coding+Standard … E.g., https://www.securecoding.cert.org/confluence/display/c/INT34-C.+Do+not+shift+an+expression+by+a+negative+number+of+bits+or+by+greater+than+or+equal+to+the+number+of+bits+that+exist+in+the+operand … (cf. noncompliant code vs. compliant solution).
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.