Does negate twice (!!) make any sense?

Posted by Dbger on Stack Overflow See other posts from Stack Overflow or by Dbger
Published on 2010-03-29T03:25:32Z Indexed on 2010/03/29 3:33 UTC
Read the original article Hit count: 300

Filed under:
|

I noticed following usage of negate (!) in our code base, like:

int GetIntFromRegistry();

bool bok = !!GetIntFromRegistry();

I am really curious about the usage of !!, it you want to cast the type from int to bool, why not just cast it explicitly use (bool), or static_cast.

Is there anything I am missing?

© Stack Overflow or respective owner

Related posts about c++

Related posts about typecasting