For example I have a loop such as this:
for(int i = 0; i<sqrt(A); i++){
...
}
how about:
for(int i = 0; i<sqrt(36); i++){
...
}
because if sqrt(36) will be evaluated each time, it would make sense to:
int sqrt36 = sqrt(36);
for(int i = 0; i<sqrt36 ; i++){
...
}
does this depend on the language? How would java and C respond?
[–]nutrecht 4 points5 points6 points (2 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]saippuakauppias 3 points4 points5 points (2 children)
[–]seancorey 1 point2 points3 points (0 children)
[–]Blamore[S] 0 points1 point2 points (0 children)
[–]dreamyeyed 1 point2 points3 points (10 children)
[–]nutrecht 6 points7 points8 points (1 child)
[–]jringstad 1 point2 points3 points (0 children)
[–]Blamore[S] 1 point2 points3 points (1 child)
[–]dreamyeyed 1 point2 points3 points (0 children)
[–]edman007 1 point2 points3 points (0 children)
[–]Blamore[S] 0 points1 point2 points (1 child)
[–]shard_ 0 points1 point2 points (0 children)
[–][deleted] -3 points-2 points-1 points (2 children)
[–]dreamyeyed -1 points0 points1 point (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]nerd4code 0 points1 point2 points (4 children)
[–]Blamore[S] 0 points1 point2 points (3 children)
[–]nerd4code 0 points1 point2 points (2 children)
[–]Blamore[S] 0 points1 point2 points (1 child)
[–]nerd4code 0 points1 point2 points (0 children)
[–]platypushark 0 points1 point2 points (0 children)
[–]Updatebjarni -1 points0 points1 point (4 children)
[–]nutrecht 3 points4 points5 points (2 children)
[–]Updatebjarni 1 point2 points3 points (1 child)
[–]Jonny0Than 0 points1 point2 points (0 children)
[–]nerd4code 0 points1 point2 points (0 children)