Как стать автором
Обновить

Комментарии 5

«It's gonna be Ok!», it should be something near zero, with some probability (near zero).
By the way, there is also such a funny fragment:
void DigitalContactTracingSweep(double t)
{
  ....
  //check every day to see if contacts become index cases - but they have to be infectious. Otherwise we could set the trigger time and cause their contacts to be traced when they are not being traced themselves.
  if ((Hosts[contact].index_case_dct == 0) && (
    Hosts[contact].is_infectious_almost_symptomatic() ||
    Hosts[contact].is_case() ||
    Hosts[contact].is_infectious_almost_symptomatic()))
  ....
}

The PVS-Studio warning: V501 [CWE-570] There are identical sub-expressions 'Hosts[contact].is_infectious_almost_symptomatic()' to the left and to the right of the '| | ' operator. Sweep.cpp 1354
The is_infectious_almost_symptomatic function is constant and does not change anything:
bool Person::is_infectious_almost_symptomatic() const
{
  return this->inf == InfStat::InfectiousAlmostSymptomatic;
}

So, there's no point in calling it twice for sure. Another matter is that it may not be the error but just an accidentally duplicated check. But maybe it's the error. Nearby there is the following code:
if (Hosts[contact].is_infectious_asymptomatic_not_case() ||
  Hosts[contact].is_case() ||
  Hosts[contact].is_infectious_almost_symptomatic())

To tell more precisely, I need, for sure, to perceive the project. I can't understand it superficially.
Hey, that was really helping. In the prevailing pandemic situation, a good developer can use a few tips from here and tweak the thing to develop a helpful project.
Зарегистрируйтесь на Хабре , чтобы оставить комментарий