Poll: Should we standardize on (and rewrite all code) passing coords in function params?
You do not have permission to vote in this poll.
Use three ints or six ints
0%
0 0%
Use Vector3 / cCuboid / cBoundingBox
100.00%
6 100.00%
Keep the current style, don't change anything
0%
0 0%
Other (I'll describe in a reply)
0%
0 0%
Total 6 vote(s) 100%
* You voted for this item. [Show Results]

Poll: Passing coords in function params
#1
I think we're long overdue for this discussion. Do we prefer passing coords between functions as three (or six) int params, or as a Vector3 / cCuboid / cBoundingBox?

There's a problem with int-based approach, especially when specifying ranges - some of the functions take the (MinX, MaxX, MinY, MaxY, MinZ, MaxZ) ordering and some the (MinX, MinY, MinZ, MaxX, MaxY, MaxZ) ordering, creating a great opportunity for subtle bugs.

On the other hand, we don't know if using the object-based approach has any performance implications on some platforms. We know that on x64 the Vector3i may actually be faster than three ints [1], but we have no idea about ARM. Can someone provide some insight / benchmarks?

So, the question is, should we change all the code to use objects, or drop the objects completely, or keep doing what we're doing now (no guidance at all)?


Ref.:
[1]: https://github.com/cuberite/cuberite/pul...r125324633
Reply
Thanks given by:


Messages In This Thread
Poll: Passing coords in function params - by xoft - 07-14-2017, 10:37 PM



Users browsing this thread: 1 Guest(s)