문제

If have this situation:

int baseValue = (3 * value) / 100

and use this value in various cases.

int width = baseValue;
int height = baseValue;
int length = baseValue;

Exist something of difference, of do this more of one time? (This is not case, only ask by question of doubt)

ex:

int width = (3 * value) / 100;
int height = (3 * value) / 100;
int length = (3 * value) / 100;

in all cases the result be the same

Would use more processing in this case?

Thanks...

도움이 되었습니까?

해결책

allocating a variable takes less processing than calculating the same again I think, might help you to try to understand how this on byte level works. But why do you ask such a question? If you're interested in the answer just make a test program and log the times.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top