Date: Tue, 13 Sep 2016 19:54:31 +0000 From: twilight <pipfstarrd@openmailbox.org> To: freebsd-hackers@FreeBSD.org Subject: What is the point in expression: !!var ? Message-ID: <7bf5cd37-6436-8cec-74e3-f0856bcc807c@openmailbox.org>
next in thread | raw e-mail | index | archive | help
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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7bf5cd37-6436-8cec-74e3-f0856bcc807c>