]> git.lyx.org Git - features.git/commitdiff
Work around MSVC warning
authorGeorg Baum <baum@lyx.org>
Thu, 26 Jun 2014 19:05:40 +0000 (21:05 +0200)
committerJean-Marc <lasgouttes@lyx.org>
Fri, 9 Jan 2015 10:54:05 +0000 (11:54 +0100)
The statement
if (pos < from + lyxrc.completion_minlength)
triggers a signed vs. unsigned warning. I don't know why this happens, it
could be a MSVC bug, or related to LLP64 (windows) vs. LP64 (unix)
programming model, or the C++ standard might be ambigous in the section
defining the "usual arithmetic conversions". However, using a temporary
variable is safe and works on all compilers.

src/Paragraph.cpp
status.21x

index 81ca22574bd0d131ec6556eb0c1bfe041280d0d1..6ba12221ba090be7bba18fb200d3e15b3c7b72a8 100644 (file)
@@ -3866,7 +3866,16 @@ void Paragraph::collectWords()
                        continue;
                pos_type from = pos;
                locateWord(from, pos, WHOLE_WORD);
-               if (pos < from + lyxrc.completion_minlength)
+               // Work around MSVC warning: The statement
+               // if (pos < from + lyxrc.completion_minlength)
+               // triggers a signed vs. unsigned warning.
+               // I don't know why this happens, it could be a MSVC bug, or
+               // related to LLP64 (windows) vs. LP64 (unix) programming
+               // model, or the C++ standard might be ambigous in the section
+               // defining the "usual arithmetic conversions". However, using
+               // a temporary variable is safe and works on all compilers.
+               pos_type const endpos = from + lyxrc.completion_minlength;
+               if (pos < endpos)
                        continue;
                FontList::const_iterator cit = d->fontlist_.fontIterator(from);
                if (cit == d->fontlist_.end())
index 3c6be0de051ff75a4aed379c6f419d6be7c88e79..3d6dcb334ade19b1c446a5e0a216c6f229dca846 100644 (file)
@@ -217,7 +217,7 @@ What's new
 
 * BUILD/INSTALLATION
 
-- Fix a couple of compiler warnings.
+- Fix some compiler warnings.
 
 - Fix a few minor issues in the RPM spec file template (bug 9349).