x > -1 vs x >= 0, is there a performance difference
问题 I have heard a teacher drop this once, and it has been bugging me ever since. Let's say we want to check if the integer x is bigger than or equal to 0. There are two ways to check this: if (x > -1){ //do stuff } and if (x >= 0){ //do stuff } According to this teacher > would be slightly faster then >= . In this case it was Java, but according to him this also applied for C, c++ and other languages. Is there any truth to this statement? 回答1: There's no difference in any real-world sense. Let's