Sjoerd Mullender wrote: > If sizeof(int) < sizeof(size_t), is it *guaranteed* that (size_t)-1 > expands to a bit pattern of all 1's? As Tim explains: If you assume that the machine uses two's complement, then yes. However, this is irrelevant. More interestingly: Is it guaranteed that you get the largest possible value of size_t? Based on the language spec fragment that Tim cites: yes. This actually isn't really relevant either. Is it guaranteed that you get a value of size_t different from all values that denote real sizes of things? To this, the answer clearly is no: There might be objects whose size is (size_t)-1. However, it is unlikely (perhaps even *unlikely* :-) that you ever meet such an object in real life. By definition, (size_t)-1 == ~(size_t)0 in all conforming implementations. Regards, Martin
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4