= width of type\", and the value zero for x." />
开发者

long long int in C, Mac OS X, Xcode 3.2.5, field width

开发者 https://www.devze.com 2023-02-07 20:40 出处:网络
In this sample: long long int x = 1<<开发者_C百科;38; NSLog(@\"Hello, World!, %qi\", x); I got \"warning: left shift count >= width of type\", and the value zero for x.

In this sample:

long long int x = 1<<开发者_C百科;38;
NSLog(@"Hello, World!, %qi", x);

I got "warning: left shift count >= width of type", and the value zero for x.

The length of a long long int is 8, so we should be able to shift up 63.

I'se puzzled....And would sho' 'preciate some help.


It's not x that's the problem, it's the 1, which is a signed integer literal constant.

Try this instead:

long long int x = 1LL << 38;
0

精彩评论

暂无评论...
验证码 换一张
取 消