[Xapian-devel] str.h warning in MSVC 9.0

Kelm, Peter ST/HZA-TG kelmpte at schaeffler.com
Tue May 5 14:09:58 BST 2009


Hello,

MSVC complains about line 74 in "xapian-core/common/str.h":

inline std::string str(bool value) { return std::string('0' | value, 1);
}

with the message:

"warning C4806: '|' : unsafe operation: no value of type 'bool' promoted
to type 'char' can equal the given constant"

I believe the intention is to do the following - or am I missing
something?

inline std::string str(bool value) { return std::string(value ? '1' :
'0'); }

Regards,

Peter



More information about the Xapian-devel mailing list