Probably a stupid question, but this is an unforgettable curiosity for me.
I have some Delphi code that looks like this:
const
KeyRepeatBit = 30;
...
// if bit 30 of lParam is set, mark this message as handled
if (Msg.lParam and (1 shl KeyRepeatBit)> 0) then
Handled: = true;
...
(the purpose of the code is not very important)
Does the compiler see "(1 shl KeyRepeatBit)" as something that can be computed at compile time, and so it becomes constant? If not, is it possible to get something by executing it as a number and replacing the expression with a number?
optimization compiler-construction delphi
robsoft
source share