Subject: Re: [Boost-bugs] [Boost C++ Libraries] #10723: UNINIT_CTOR(boost::âmulti_index::âdetail::âbidir_node_iterator<boost::âmulti_index::âdetail::âordered_index_node<boost::âmulti_index::âdetail::âordered_index_node<boost::âmulti_index does not get initialised)
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-08-27 19:25:25
#10723: UNINIT_CTOR(boost::âmulti_index::âdetail::âbidir_node_iterator<boost::
multi_index::âdetail::âordered_index_node<boost::âmulti_index::âdetail::
ordered_index_node<boost::âmulti_index does not get initialised)
----------------------------------------------+-------------------------
Reporter: anup kumar <anup.shrivastava@â¦> | Owner: joaquin
Type: Bugs | Status: closed
Milestone: To Be Determined | Component: multi_index
Version: Boost 1.54.0 | Severity: Cosmetic
Resolution: fixed | Keywords: UNINIT_CTOR
----------------------------------------------+-------------------------
Comment (by joaquin):
Hi anonymous,
The default constructor is needed because it is permissible (and very
useful) to default initialize an iterator, so we can't just omit this
constructor. When default-initialized, the iterator has a ''singular''
value according to the C++ standard terminology in
'''[iterator.requirements.general]/5'''. Dereferencing a singular value is
undefined behavior, so the programmer is not allowed to do it regardless
of whether the value of the pointer is null or not. My reluctance to
initialize to null comes from the fact that we're introducing a run-time
penalty in default construction (even if a negligible one) that, in the
best of cases, will only expose undefined behavior more nicely.
Anyway, is perhaps the annotation commited in
https://github.com/boostorg/multi_index/commit/08fe6a360acf99e1732a54ef8b3114455f59116b
not silencing the Coverity warning?
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/10723#comment:5> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:18 UTC