What is the point in expression: !!var ?
twilight
pipfstarrd at openmailbox.org
Tue Sep 13 20:02:34 UTC 2016
Hello,
I'm digging through FreeBSD cppcheck scan report with hope to catch some
bugs.
I've came along a line:
c = cond(token, val, yylex(), noeval | !!a);
What's the point in using !! twice? Can it be deleted?
Here is the context:
static arith_t cond(int token, union yystype *val, int op, int noeval)
{
arith_t a = or(token, val, op, noeval);
arith_t b;
arith_t c;
if (last_token != ARITH_QMARK)
return a;
b = assignment(yylex(), noeval | !a);
if (last_token != ARITH_COLON)
yyerror("expecting ':'");
token = yylex();
*val = yylval;
c = cond(token, val, yylex(), noeval | !!a);
return a ? b : c;
}
--
Cheers~
PGP key fingerprint:
07B3 2177 3E27 BF41 DC65 CC95 BDA8 88F1 E9F9 CEEF
You can retrieve my public key at pgp.mit.edu.
More information about the freebsd-hackers
mailing list