paulharris at computer.org
Sun Mar 29 09:19:58 UTC 2009
2009/3/29 Willi Richert <w.richert at gmx.net>:
> On Freitag 27 März 2009 20:10:37 martin f krafft wrote:
>> also sprach Willi Richert <w.richert at gmx.net> [2009.03.27.1959 +0100]:
>> > I just send the patch for a new libkdtree++ version where you don't have
>> > to specify the number of dimensions at compile time. I moved the template
>> > parameter __K to a normal KDTree argument dim.
>> Why? What happens when you now search a 3D tree with a 2D or 4D
> That could easily be solved by assertions at the according methods, imho.
> Isn't assert ignored if you compile with all gcc optimizations enabled? Then
> one would have checks while developing and then abandon those for the final
yes asserts are ignored for optimised builds. Compile-time checks are
always more desirable than runtime checks - you don't need to execute
every code path to test that the code is correct. As I continue to
learn as a developer, I have found that moving more checks into
compile-time has helped me create more correct code.
Anyway I think both the Python and C++ gods can be served in this case.
More information about the libkdtree-devel