1,139 karma · joined April 7, 2018
git update-ref <branch-name> <commit-sha>The semi-joke I always heard about this was that if you don't pay commissions, you'll hire a sales team who are good at selling you that they are doing a good job, rather than selling the prodct.
35-44: 62% 45-54: 70% 55-64: 75% 65+: 79%
f(n) = { 1 if there is a Turing machine with at most n states that solves the Halting problem;
0 otherwise }
and we can easily show that f(n) is computable without proving that the Halting problem is undecideable. Viz., f is either constant 0; or equal to a function of the form g_k(n) = { 1 if n >= k;
0 if n < k },
and both the constant 0 function, and all the g_k functions, are computable; thus f is computable.> Permissible undefined behavior ranges from ignoring the situation completely with unpredictable results, to […]
And I think this is where “can’t happen” comes in: in the case of undefined behaviour, the compiler is free to emit whatever it pleases, including pretending it cannot happen!
#define FOO 17
void bar(int x, int y) {
if (x + y >= FOO) {
//do stuff
}
}
void baz(int x) {
bar(x, FOO);
}
the compiler can inline the call to bar in baz, and then optimise the condition to (x>=0)… because signed integer overflow is undefined, so can’t happen, so the two conditions are equivalent.The countless messages about optimisations like that would swamp ones about real dangerous optimisations.
The classic case of this is that the compiler cannot tell that
new StringReader("Example").read()
doesn't throw an SSLException.