The first operation probably has no meaning because, unless i
is static, you've left i
uninitialized.
You're misguided and focusing on the wrong things. Guessing isn't going to get you anywhere; bring out a profile, profile your code, and find out with data which parts need to be optimized. Optimizations are design changes, be them different data structures or algorithms.
You heavily underestimate compilers. Nothing you do is going to make a difference with such tiny changes, both will compile to whichever the compiler decides is faster. If you want an integer at one, just do: int i = 1;
and live your life. If you want to compare if an integer is less than or equal to X, then just say so: i <= X;
. Write clean readable code. On a side note, your two comparisons are not the same when X is at it's maximal value; you'll overflow when you add one.
If you're really serious, again: pull out a profiler. Another thing to do is look at the generated assembly and see which instructions it generates. If you don't know how to do that, chances are you're probably not in a position to need optimization. :/