
Mateusz Loskot wrote:
On 04/08/10 08:51, Niels Dekker wrote:
I can think of a few possible options:
* Add #pragma warning(disable: 6385) to boost/array.hpp
* Or add an __analysis_assume call to boost::array::operator[]:
reference operator[](size_type i) { BOOST_ASSERT( i < N && "out of range" ); __analysis_assume(i < N); return elems[i]; }
* Or add __analysis_assume(expr) to the BOOST_ASSERT(expr) macro itself... (boost/assert.hpp)?
I'd second the first or the second option as they are more explicit, thus self-documenting. The third option would hide this issue behind BOOST_ASSERT.
I think all three options are okay. What do you mean by "the third option would hide this issue"? The BOOST_ASSERT already states explicitly that operator[](i) *assumes* i < N, right? I guess a modification of BOOST_ASSERT might need some more discussion, though. Kind regards, Niels -- Niels Dekker http://www.xs4all.nl/~nd/dekkerware Scientific programmer at LKEB, Leiden University Medical Center