19 ms·
> So, “i << 32” buried in a million lines of database code makes the entire program junk – supposedly as an “optimization”! I think the author has it wrong her
by Spivak 6y ago
> So, “i << 32” buried in a million lines of database code makes the entire program junk – supposedly as an “optimization”!
I think the author has it wrong here because they’re assuming lines and order has any meaning when the program is compiled all together. Imagine a compiler where (I know that this is not actually possible to do) undefined behavior was a compiler error.
You would sound crazy for complaining that “a syntax error in like 4325 make the whole program uncompileable.”
It’s not like running C programs have any idea that they are hitting undefined behavior. It’s just that the generated assembly is allowed to assume that you know what you’re doing.
i << runtime_val
Can just generate the shift without worry that it will blow up and the propagate the knowledge up that runtime_val’s domain is [0,31] for the optimizer.