What is the point in expression: !!var ?

Warner Losh imp at bsdimp.com
Tue Sep 13 20:45:27 UTC 2016


On Tue, Sep 13, 2016 at 12:54 PM, twilight <pipfstarrd at openmailbox.org> wrote:
>         c = cond(token, val, yylex(), noeval | !!a);

!!foo converts the expression to 0 or 1. Since there's only one |
here, it will set the low bit iff a != 0. Without it, it will or in
whatever value a has, which may be wrong...

Warner


More information about the freebsd-hackers mailing list