开发者

std::vector<unsigned short> somehow contains numbers > 300?

开发者 https://www.devze.com 2023-04-05 13:17 出处:网络
I have a std::vector<unsigned short> that somehow contains numbers that are greater than 300. unsigned short usually only permits 0 to 255, nowhere in开发者_如何学编程 the program attempts to a

I have a std::vector<unsigned short> that somehow contains numbers that are greater than 300.

unsigned short usually only permits 0 to 255, nowhere in开发者_如何学编程 the program attempts to add numbers that large and presumably attempts should fail.

How might this have occurred?

edit: Sorry about this, it's not much of a useful question, seems I had the usigned short range wrong.


unsigned short usually only permits 0 to 255

This is incorrect; unsigned short must have a range at least 0 to 65,535 (216 - 1).

0

精彩评论

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

关注公众号