[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi] [PATCH] Avoid type mismatch between std::size_t and unsigned int

From: Vadim Zeitlin
Subject: [lmi] [PATCH] Avoid type mismatch between std::size_t and unsigned int
Date: Sat, 27 Feb 2016 21:40:55 +0100


 Here is another very simple patch required to fix compilation with gcc5
and clang as the current code results in a warning in 64 bit builds (which
are the default under the current Linux systems) when assigning a 64 bit
result of std::vector<>::size() to "unsigned int selection" and then an
error when using std::min() with two different types.

 Instead of spelling out the type precisely, I think using C++11 auto makes
the code more clear and more correct as we don't really care about the type
of the "selection" variable here, just that it's of the same type as size(),
so all I did was to replace the hardcoded type of "selection" variable with

 Thanks in advance for applying this,

Attachment: Avoid-warning-about-assigning-std-size_t-to-unsigned.patch
Description: Text document

reply via email to

[Prev in Thread] Current Thread [Next in Thread]