Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Post History
SE user DU Jiaen provided the following answer, edited by Martin Zabel and found here. The expression i >= 0 is always true if i is of an unsigned integer type. The alternative and simple way...
Answer
#1: Initial revision
_SE user [DU Jiaen](https://stackoverflow.com/users/3003290) provided the following answer, edited by [Martin Zabel](https://stackoverflow.com/users/5466118) and found [here](https://stackoverflow.com/a/35570713/5397930)._ <hr /> The expression `i >= 0` is always true if `i` is of an unsigned integer type. The alternative and simple way is to change it into: uint64_t i; for (i = 15; i != -1; i--) { ... } This works no matter if i is a signed or an unsigned integer. In the `uint64_t` case, `-1` will first get converted into `0xFFFFFFFFFFFFFFFF` and then compared with `i`. If you want to get rid of the compile warning, change it into: i != (uint64_t)-1 but you need to ensure the `uint64_t` is exactly the type of `i`.