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

Olly Betts olly at survex.com
Fri May 15 08:05:05 BST 2009


On Tue, May 05, 2009 at 06:59:44PM +0200, Kelm, Peter  ST/HZA-TG wrote:
> what do you mean by "less good"? Is the difference sensible? If so, where?

I don't recall if I compared them with a microbenchmark or just compared
the assembler code produced, but it would have been one or the other, or
perhaps both.  I definitely did timings for the integer to string
routines.

> Personally, I had issues with understanding that code line initially.
> So, in terms of readability I would prefer Eric's variant.

These are meant to be efficiently implemented, low-level routines, so
the readability of a single statement function with a clearly documented
behaviour matters less I feel.  You can even exhaustively test its
behaviour on all possible inputs (as we now do)!

> Furthermore, I would argue for not turning it off globally - as this
> will silence it also in cases where we might want it to show up.

If I felt the warning to be useful, I wouldn't have suggested globally
disabling it...

If someone wants to suggest a clean patch which they've tested and can
confirm suppresses the warning for MSVC for just this function, I'll
consider it.  Otherwise I'm just going to disable the warning globally
and be done with it.  There are really more useful ways to improve
Xapian than discussing this single line of code further.

Cheers,
    Olly



More information about the Xapian-devel mailing list