Adding or Subtracting (in general)


i solved the if statemant in another way like this and it works:

		if (GetWorld()->GetTimeSeconds() >= DoorLastOpend + DoorCloseDelay)

In the first view it does exactly the same. So it is OK for me.

I´m a beginner in programming and i asked myself: Is there a fundamental reason why doing it your way?

By adding numbers (like i did) numbers may become large. You used a way of substraction. Is it preffered because of i.e. memory usage, avoiding to reach the end of “int” or “float” range? But then GetTimeSeconds() would have the same problem, right?

Or doesn´t matter it, because it is trivial?


Well it shouldn’t matter here as DoorCloseDelay is a relatively small number but I wouldn’t want to make it easier for overflow to occur by adding the numbers.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms