shift-count-overflow possible issue on 64bit type

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I see on my 64bit Ubuntu PC that size_t is 8 bytes, that is 64bits, however I see a warning:

$ g++-8 -Wall -Wextra -o size_t size_t.cpp
size_t.cpp: In function ‘int main()’:
size_t.cpp:11:21: warning: left shift count >= width of type [-Wshift-count-overflow]
     size_t big = 1<<40;
                     ^~



Same on Godbolt trunk.
Is this an issue?

Regards, Jonny

https://godbolt.org/z/xeefQ8

#include <stdio.h>
size_t big = 1<<41;



Please keep my email on any replies
Jonny



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux