c++ - Bit manipulation tilde -


i understand tilde flips every bits, if int num = ~0
why result num = -1 , neither max value of int or unsigned int?

but max value of unsigned:

#include <iostream> #include <limits>  int main() {   std::cout << ( unsigned(-1) == std::numeric_limits<unsigned>::max() )             << std::endl;   return 0; } 

http://ideone.com/y4jufe


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -