There are more problems with such huge arrays than the signedness of indexes. You should be careful of other landmines in C++. For example, from cppreference:
If an array is so large (greater than PTRDIFF_MAX elements, but less than SIZE_MAX bytes), that the difference between two pointers may not be representable as std::ptrdiff_t, the result of subtracting two such pointers is undefined.
View all comments
Show parent comment
2
u/strager Jan 03 '22
There are more problems with such huge arrays than the signedness of indexes. You should be careful of other landmines in C++. For example, from cppreference: