Reputation: 19117
Take this simple code:
void CChristianLifeMinistryEditorDlg::OnOptionsAddTimeToConcludingComments()
{
BOOL bAddTime = CChristianLifeMinistryUtils::AddRemainingTimeToConcludingComments();
bAddTime = !bAddTime;
CChristianLifeMinistryUtils::SetAddRemainingTimeToConcludingComments(bAddTime);
UpdateMenuGUI();
SetModified(true);
}
The !bAddTime
is being flagged:
It says:
Using logical '!' when bitwise '~' was probably intended.
I have used this technique before to toggle boolean values it appears to operate correctly. So why the warning? It is not related to Visual Assist.
Upvotes: 1
Views: 77
Reputation: 51413
Simply change
BOOL bAddTime = ...
to
bool bAddTime = ...
I guess the static code analysis gets confused by BOOL
being a type alias for int
.
Upvotes: 3