7 ms·
No. (size_t)-1 and SIZE_MAX are identical, there is no difference in the two ways of writing that. Furthermore, optimisation can't bite you if you test the va
by caf 4y ago
No. (size_t)-1 and SIZE_MAX are identical, there is no difference in the two ways of writing that.
Furthermore, optimisation can't bite you if you test the values before you perform the potentially UB operation (and unsigned operations can never overflow anyway, they are always well-defined).
- pjmlp 4y agoThat was just an assumption, far from me to know all UB cases, I leave that for tooling.