1#include <stdio.h>2 intMain ()3 {4UnsignedintDwval =0;5unsigned __int64 n64val =1;6 if(Dwval-n64val >= -)7 {8printf"%i64d\n", Dwval-n64val);//execute this line, output-19 }Ten return 0; One}
Personal analysis:
When you do want to reduce the operation (Dwval-n64val), the Dwval and N64val are converted to unsigned __int64,
The two want to reduce the result is-1, storage for 0xFFFFFFFFFFFFFFFF, as unsigned __int64 use
Compared to the following number (20), the result of the calculation is true, and the result of the printout is the __int64 type
The corresponding value is-1
Further verification:
1#include <iostream>2 intMain ()3 {4UnsignedintDwval =0;5unsigned __int64 n64val =1;6unsigned __int64 N64val2 =0xffffffffffffffff;7 if(Dwval-n64val >=n64val2)8 {9printf"%i64d\n", Dwval-n64val);//execute this line, output-1Ten } OneN64val2 = Dwval-n64val;//N64val2 = 0xffffffffffffffff ASystem"Pause"); - return 0; -}
1#include <iostream>2 intMain ()3 {4UnsignedintDwval =0;5unsigned __int64 n64val =2;6unsigned __int64 N64val2 =0xffffffffffffffff;7 if(Dwval-n64val >=n64val2)8 {9printf"%i64d\n", Dwval-n64val);//Do not get hereTen } OneN64val2 = Dwval-n64val;//N64val2 = 0xfffffffffffffffe, less than N64val2 ASystem"Pause"); - return 0; -}
Thoughts on GetTickCount () 49.7 days after counting zero
_logtick = :: GetTickCount64 (); // dosomething; if (:: GetTickCount ()-_logtick >= Log_tick_max) { printf ("%i64d\n",:: GetTickCount ()- _logtick); }
Two unsigned types want to subtract the result stored temporary variable or unsigned type