Boost logo

Boost :

Subject: Re: [boost] [teeks99][test] Test failures on MSVC 8-11
From: Bjorn Reese (breese_at_[hidden])
Date: 2015-11-22 11:21:10

On 11/21/2015 09:54 PM, Raffi Enficiaud wrote:

> static std::map<char,char const*> const char_type{{
> {'<' , "lt"},
> {'>' , "gt"},
> {'&' , "amp"},
> {'\'', "apos"},
> {'"' , "quot"}
> }};
> #else /.../

I would replace the std::map with a switch statement in this case. Then
there is no need for an #ifndef.

> and maybe because of "-Werror=sign-compare" ? or again this is hiding
> something else that was cut off in the report...

The problem is that if we test an unsigned integer against a literal
integer value, then we a warning in the first test but not the second:

   unsigned int value = 1;
   BOOST_REQUIRE(value == 1); // No sign compare warning
   BOOST_REQUIRE_EQUAL(value, 1); // Sign compare warning

The quick fix is for all Boost.Test users to do:


but this is inconvenient if you do not know the signedness of the type,
e.g. when you use a size() member function on some container.

Boost list run by bdawes at, gregod at, cpdaniel at, john at