Skip to content

Commit 1895375

Browse files
committed
Use auto where type does not matter (and is likely signed)
This avoids conversion warnings with Visual Studio.
1 parent 86f51f9 commit 1895375

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

jbmc/unit/java_bytecode/java_bytecode_instrument/virtual_call_null_checks.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,10 @@ SCENARIO(
6060
{
6161
// This just checks that the class actually makes the expected call,
6262
// i.e. that it hasn't been optimised away or similar.
63-
std::size_t found_virtualmethod_calls =
64-
std::count_if(
65-
main_function.body.instructions.begin(),
66-
main_function.body.instructions.end(),
67-
is_expected_virtualmethod_call);
63+
auto found_virtualmethod_calls = std::count_if(
64+
main_function.body.instructions.begin(),
65+
main_function.body.instructions.end(),
66+
is_expected_virtualmethod_call);
6867

6968
REQUIRE(found_virtualmethod_calls == 1);
7069
}

unit/util/irep.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ SCENARIO("irept_memory", "[core][utils][irept]")
148148
irep.add("a_new_element", irep2);
149149
REQUIRE(!irept::is_comment("a_new_element"));
150150
REQUIRE(irep.find("a_new_element").id() == "second_irep");
151-
std::size_t named_sub_size =
151+
auto named_sub_size =
152152
std::distance(irep.get_named_sub().begin(), irep.get_named_sub().end());
153153
REQUIRE(named_sub_size == 1);
154154

unit/util/range.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,7 @@ SCENARIO(
406406
THEN("A range of made from the vector can be filtered.")
407407
{
408408
const auto odds_filter = make_range(input).filter(is_odd);
409-
const std::size_t total =
410-
std::distance(odds_filter.begin(), odds_filter.end());
409+
const auto total = std::distance(odds_filter.begin(), odds_filter.end());
411410
REQUIRE(total == 5);
412411
auto iterator = odds_filter.begin();
413412
REQUIRE((iterator++)->value == 1);

0 commit comments

Comments
 (0)