Well, it depends on the actual size of the type long
(more precisely, its width in bits). Most likely on your platform long
has width of 32 bits, so you get 0
as the result (also, see P.S. below). Use a bigger type. long long
maybe?
P.S. As an additional note, shifting a type by more bits than its width (or equal number of bits) produces undefined behavior in C and C++ (C++ uses the term length instead of width). So, you are not guaranteed to get 0
from neither 1L << 37
nor 1L << 32
on a platform where long
has width 32.