Hello, everyone. As an inexperienced/rusty user of C, I have come across a question for you all.
Does C's >> operator shift in zeros or sign-bits in the compilers with which you are familiar? For example:
Should I expect 10000000 or F0000000 to be printed?
I seem to remember reading somewhere that this behavior of >> is compiler-dependent, and I will be using gcc for my 65m32 simulator. I can spend a bitmore effort to explicitly deal with the MSBs in my code, should it turn out to be a potential portability issue.
Thanks,
Mike
Does C's >> operator shift in zeros or sign-bits in the compilers with which you are familiar? For example:
Code:
/* let's assume that unsigned is 32-bits wide here */
unsigned a = 0x80000000U;
printf("%X", a >> 3);I seem to remember reading somewhere that this behavior of >> is compiler-dependent, and I will be using gcc for my 65m32 simulator. I can spend a bitmore effort to explicitly deal with the MSBs in my code, should it turn out to be a potential portability issue.
Thanks,
Mike
Aucun commentaire:
Enregistrer un commentaire