What does this program print with GCC or Clang on x86-64 / ARM64?
#include <stdio.h>
int main(void) {
int x = -16;
printf("%d %d\n", x >> 2, x / 4);
return 0;
}
The result of right-shifting a negative value is implementation-defined; GCC and Clang do an arithmetic shift, copying the sign bit, so −16 >> 2 = −4. (For −15 the two would differ: >> rounds down to −4, division rounds towards zero to −3.)