Vitaliy Margolen wrote:
Vitaly Budovski wrote:
Vitaliy Margolen wrote:
Thanks for the tip. Unfortunately in this instance it will not work as I do in fact query more than a < b. See the nearest function in patch 2.
And what is so special about subtracting one from the other?
A lot actually. As an example with squared distances: a^2 - b^2 <= c^2. If a^2 = 27, b^2 = 16, c^2 = 9, then 27 - 16 <= 9 is false. However, if we use the square root in distance calculations, sqrt(27) - 4 <= 3 is true. As you can see, we get entirely different results.
The qsort function I use internally takes that particular function pointer.
And the problem is what? Any pointer is compatible with void* (not other way around).
Vitaliy Margolen.
I get a warning from gcc: passing argument 4 of ‘qsort’ from incompatible pointer type.