How come << falls through at 16 on a 32-bit integer?

Mark William Hopkins markh at csd4.csd.uwm.edu
Sat Apr 13 11:21:56 AEST 1991


Why am I getting 0 for output here when unsigned long's are 32 bits with the
Quick C Version 2.5 compiler?  (Casting everything to unsigned long does not
help).

* #include <stdio.h>
* main() {
*    unsigned long M = 34;
*    printf("%08x\n", M << 16);
* }

This is a compiler bug, according to my understanding of the Quick C manual
and C language.



More information about the Comp.lang.c mailing list