Double Negation in C++

后端 未结 14 2617
你的背包
你的背包 2020-11-22 10:40

I just came onto a project with a pretty huge code base.

I\'m mostly dealing with C++ and a lot of the code they write uses double negation for their boolean logic.

14条回答
  •  囚心锁ツ
    2020-11-22 10:56

    Maybe the programmers were thinking something like this...

    !!myAnswer is boolean. In context, it should become boolean, but I just love to bang bang things to make sure, because once upon a time there was a mysterious bug that bit me, and bang bang, I killed it.

提交回复
热议问题