WriteArticleRecord small knowledge points.
The first is I ++ and ++ I. Here I am talking about performance problems, rather than being equal to I or equal to I + 1, in fact, it is easy to know that the performance of ++ is better than that of I ++, But weProgramIf it is not affected, I ++ will be used; in fact, this is not a good practice, at least the performance is slightly poor.
++ I simulation:
Int fuction () {I = I + 1; return I ;}
I ++ simulation:
Int function () {int temp = I; I = temp + 1; return temp ;}
I ++ has more temp and the performance is not good. We recommend that you select ++ I without affecting the program logic ..
I + = 1 and I = I + 1.OneYou can see examples frequently.The following statement is as follows:It is based on a language without automatic forced type conversion, such as Java, which does not include C ++.
Example1:
Short I = 1; I = I + 1;
Example2:
Short I = 1; I + = 1;
Based on that premise, example1 will certainly have compilation problems. It is not feasible to assign int to short, but example2 is no problem ..