
On 04/08/10 08:51, Niels Dekker - address until 2010-10-10 wrote:
On 2010-08-02-Mon 18:29, Mateusz Loskot wrote:
Shall I report a ticket?
Do you have a proposed fix?
Actually, I'm asking for suggestions :-)
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)?
What do you think?
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.
BTW, the following compiler bug report seems related: Microsoft Visual Studio bug report ID 281033, "False warning C6385 when a function result is used as an array index", http://connect.microsoft.com/VisualStudio/feedback/details/281033/
Thanks. Best regards, -- Mateusz Loskot, http://mateusz.loskot.net Charter Member of OSGeo, http://osgeo.org