patch to make libkdtree compatible with g++-4.2 and g++-4.3

Paul Harris paulharris at computer.org
Sun Oct 26 04:29:30 UTC 2008


(resent) sorry had to compress the patch, the original email is stuck in the
moderator's queue...


Hi all,

I'll continue this email thread... attached is a smallish patch (I'm not
familiar with git so I started smallish).  It removes all the method
specifiers that say throw()... eg

void do_something throw() { }

The throw() things are not desirable as kdtree should be exception
transparent... the throw()s caused problems with my program, as sometimes
accessors could throw an exception - and the no-throw guarantee that kdtree
was imposing prevented it from compiling.

I also had trouble compiling kdtree for a visual c++ 2005 program, because
(IIRC) of the use of GCC's __throw_exception_again extension.

Instead, I switched to a class-destructor pattern (I forget the patterns
name) which basically uses a class to manage the lifetime of the pointer...

_Link_type _M_new_node( etc)
{
        typename _Base::NoLeakAlloc noleak(this);  <-- see allocator.hpp for
definition. this allocs memory
         _Link_type new_node = noleak.get();   <-- just get the pointer from
noleak
         _M_construct_node(new_node, __V, __PARENT, __LEFT, __RIGHT);  <--
do the thing that could throw an exception
         noleak.disconnect();  <--- if we are here, then all went well. call
this function that stops noleak from deallocating on destruction
         return new_node;
}

else if construct_node threw an exception, noleak's destructor would
automatically dealloc the node.



I also extended the 'examples' Makefile so it'll try compiling it with gcc
3.4, 4.2 and 4.3 (run make all_gcc). I corrected a minor problem in the test
file (missing include file).


Note that I have a bunch more changes to work through, but I need to merge
the changes from the trunk into mine first... so I thought I'd start with
this throw() task.  BUT that means I haven't tested out kdtree on my
application, so if people could please test out this patch, reject or accept
it, that would be great.

cheers
Paul


2008/10/26 Paul Harris <paulharris at computer.org>

I agree, it is time to revise naming.  I did some revision on my local
> version but with less underscores.
>
> I suggest we make small changes (such as this patch) to libkdtree for
> debian's release packaging for the moment since Lenny needs to stablise very
> soon, and I'll see if we can get the ball rolling on merging in bigger
> changes for 0.7.0
>
> I'll have a quick look now to see if there are any other small changes from
> my local version that I can bring in to 0.6.3...
>
> 2008/10/25 martin f krafft <madduck at debian.org>
>
>> also sprach Martin SCHREIBER <martin.schreiber at in.tum.de>
>> [2008.10.25.0404 +0200]:
>> > is it possible that you patch the git sources and create a new
>> > version 0.6.3?
>>
>> Even though the patch might well work, it strikes me as hackish.
>> Maybe it's time to revise the naming completely?
>>
>> Cheers,
>>
>> --
>>  .''`.   martin f. krafft <madduck at debian.org>
>> : :'  :  proud Debian developer, author, administrator, and user
>> `. `'`   http://people.debian.org/~madduck<http://people.debian.org/%7Emadduck>-
>> http://debiansystem.info
>>  `-  Debian - when you have better things to do than fixing systems
>>
>> in africa some of the native tribes have a custom of beating the
>> ground with clubs and uttering spine chilling cries. anthropologists
>> call this a form of primitive self-expression. in america they call
>> it golf.
>>
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1.4.9 (GNU/Linux)
>>
>> iEYEARECAAYFAkkC9boACgkQIgvIgzMMSnVUTgCghHcFfomXpiBsUyCOLFKFvNVc
>> /BEAn1PVy1F2qgXqYQanTpn+VCPBBSt2
>> =DBLS
>> -----END PGP SIGNATURE-----
>>
>> _______________________________________________
>> libkdtree-devel mailing list
>> libkdtree-devel at lists.alioth.debian.org
>> http://lists.alioth.debian.org/mailman/listinfo/libkdtree-devel
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.alioth.debian.org/pipermail/libkdtree-devel/attachments/20081026/e38f0023/attachment-0001.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-commit-cd1308768bb4a1c6444c5174b05540a04ea72ab1.patch.bz2
Type: application/x-bzip2
Size: 4708 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/libkdtree-devel/attachments/20081026/e38f0023/attachment-0001.bin 


More information about the libkdtree-devel mailing list