假设我有以下C代码:
int i = 5; int j = 10; int result = i + j;
如果我多次循环,使用它会更快int result = 5 + 10吗?我经常创建临时变量以使我的代码更具可读性,例如,如果使用某个长表达式从某个数组中获取这两个变量来计算索引.这在C中是否表现不佳?其他语言怎么样?
int result = 5 + 10
c performance temporary
c ×1
performance ×1
temporary ×1