﻿# V552\. A bool type variable is incremented\. Perhaps another variable should be incremented instead\.

The analyzer detected a potentially dangerous construct in code where a variable of the bool type is being incremented\.

Consider the following contrived example:

```cpp
bool bValue = false;
...
bValue++;
```

First, the C\+\+ language's standard reads:

The use of an operand of type bool with the postfix \+\+ operator is deprecated\.

It means that we should not use such a construct\.

Second, it is better to assign the 'true' value explicitly to this variable\. This code is clearer:

```cpp
bValue = true;
```

Third, it might be that there is a misprint in the code and the programmer actually intended to increment a different variable\. For example:

```cpp
bool bValue = false;
int iValue = 1;
...
if (bValue)
  bValue++;
```

A wrong variable was used by accident here while it was meant to be this code:

```cpp
bool bValue = false;
int iValue = 1;
...
if (bValue)
  iValue++;
```