New hashtable power 2 rehash policy

François Dumont frs.dumont@gmail.com
Tue May 17 20:28:00 GMT 2016


On 14/05/2016 19:06, Daniel Krügler wrote:
> 2016-05-14 18:13 GMT+02:00 François Dumont <frs.dumont@gmail.com>:
>
>> New patch attached, tested under linux x86_64.
>>
>> François
> 1) The function __clp2 is declared using _GLIBCXX14_CONSTEXPR, which
> means that it is an inline function if and *only* if
> _GLIBCXX14_CONSTEXPR really expands to constexpr, otherwise it is
> *not* inline, which is probably not intended and could easily cause
> ODR problems. I suggest to mark it unconditionally as inline,
> regardless of _GLIBCXX14_CONSTEXPR.

Maybe _GLIBCXX14_CONSTEXPR should take inline value previous to C++14 mode.

For the moment I simply added the inline as done in other situations.

>
> 2) Furthermore I suggest to declare __clp2 as noexcept - this is
> (intentionally) *not* implied by constexpr.
>
> 3) Is there any reason, why _Power2_rehash_policy::_M_next_bkt
> shouldn't be noexcept?
>
> 4) Similar to (3) for _Power2_rehash_policy's member functions
> _M_bkt_for_elements, _M_need_rehash, _M_state, _M_reset
For noexcept I throught we were only adding it if necessary. We might 
have to go through a lot of code to find all places where noexcept could 
be added. Jonathan will give his feedback.

For the moment I have added it on all those methods.

Thanks for feedback, updated and tested patch attached.

François

-------------- next part --------------
A non-text attachment was scrubbed...
Name: hashtable.patch
Type: text/x-patch
Size: 26858 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20160517/e8f56acd/attachment.bin>


More information about the Gcc-patches mailing list