[Xapian-devel] Re: [Xapian-commits] 7283: trunk/xapian-core/ trunk/xapian-core/net/

Olly Betts olly at survex.com
Wed Oct 4 19:06:23 BST 2006

On Wed, Oct 04, 2006 at 05:38:47PM +0100, richard at lemurconsulting.com wrote:
> MSVC gives a warning: "serialise.cc(52) : warning C4309: 'static_cast' :
> truncation of constant value".  I looked at the code and thought that this
> meant that the 0x80 would be truncated to 0.  Of course, this is foolish,
> and it actually gets converted to "-128".

The warning is poorly worded for this case, so I can see how you jumped
to that conclusion.

> It would be nice to remove the warning on windows though.  Would
> "static_cast<char>(-128)" be equivalent?  Or is the code after my patch
> still correct?

I think the code after is still correct.

My worry was really just that I've already had several iterations
chasing away warnings about char casting (I thought it was on exactly
this code, but SVN history suggests it was elsewhere, or that I only
checked in the last version).  I just had a sinking feeling about
restarting that, especially as preparing the next release is already
dragging on.

But it's good to be warning free, and the tinderbox results for your
revised version are good so far (although Sun C++ isn't in yet, and I
suspect that's the most likely to moan).  So I think leave the patch for
now.  If it gives us warnings elsewhere we can decide which compiler
we'd rather placate.

Have you tried MSVC on omega?  Quite a lot has changed there (omindex


More information about the Xapian-devel mailing list