What is the point in expression: !!var ?

Daniel Shahaf danielsh at apache.org
Tue Sep 13 20:42:37 UTC 2016


Cedric Blancher wrote on Tue, Sep 13, 2016 at 22:10:24 +0200:
> The point is to transform the value of a (any kind, like pointer) to a
> Boolean value.

In more words: «!!x» is equivalent to «(x ? 1 : 0)».

Daniel


More information about the freebsd-hackers mailing list