Why use !! when converting int to bool?

前端 未结 10 1835
梦谈多话
梦谈多话 2020-11-30 22:37

What can be a reason for converting an integer to a boolean in this way?

bool booleanValue = !!integerValue;

instead of just



        
10条回答
  •  盖世英雄少女心
    2020-11-30 22:44

    No big reason except being paranoid or yelling through code that its a bool.

    for compiler in the end it wont make difference .

提交回复
热议问题