std::forward_list optim for always equal allocator
François Dumont
frs.dumont@gmail.com
Mon Sep 11 05:12:00 GMT 2017
On 08/09/2017 18:19, Jonathan Wakely wrote:
> On 28/08/17 21:09 +0200, François Dumont wrote:
>> Hi
>>
>> Any news for this patch ?
>>
>> It does remove a constructor:
>> - _Fwd_list_impl(const _Node_alloc_type& __a)
>> - : _Node_alloc_type(__a), _M_head()
>>
>> It was already unused before the patch. Do you think it has ever
>> been used and so do I need to restore it ?
>>
>> I eventually restore the _M_head() in _Fwd_list_impl constructors
>> cause IMO it is the inline init of _M_next in _Fwd_list_node_base
>> which should be removed. But I remember Jonathan that you didn't want
>> to do so because gcc was not good enough in detecting usage of
>> uninitialized variables, is it still true ?
>
> Why should it be removed?
>
>
>
When user declare a container iterator like that:
std::forward_list<int>::iterator it;
There is no reason to initialize it with a null node pointer. It is just
an uninitialized iterator which is invalid to use except to initialize it.
I once proposed to do the same simplification for the unordered
containers _Hash_node_base. But you said that detection of the usage of
uninitialized variable is not good enough in gcc to leave variables
uninitialized this way.
More information about the Libstdc++
mailing list