From owner-freebsd-hackers@freebsd.org Tue Sep 13 20:02:34 2016 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 06F95BD7B5D for ; Tue, 13 Sep 2016 20:02:34 +0000 (UTC) (envelope-from pipfstarrd@openmailbox.org) Received: from smtp14.openmailbox.org (smtp14.openmailbox.org [62.4.1.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C21B69DA for ; Tue, 13 Sep 2016 20:02:33 +0000 (UTC) (envelope-from pipfstarrd@openmailbox.org) Received: by mail2.openmailbox.org (Postfix, from userid 1001) id 8D7E8101D28; Tue, 13 Sep 2016 21:54:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=openmailbox.org; s=openmailbox; t=1473796468; bh=/I/ww3bY2IMBs0XBpptQxqA2pYWQkuHypgeBDTGSoJc=; h=To:From:Subject:Date:From; b=ZP/k+Rl6BidleKqvHTdKmvYGVEjKB7uIieI0SzjeeG96zEpv8OCtpwhxyFonr4aDH 2ZSYjrmLPE25y7LxuKtCLb0BxfoQRCtCTKqNSOqPBPj35fALtUR8JOf37Yh/p6yP6R rGPrCpRwt887T05ufDYABXXXlLzAi/dolGDJ6Tno= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on h4 X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,NO_RECEIVED, NO_RELAYS,PLING_QUERY,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 To: freebsd-hackers@FreeBSD.org DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=openmailbox.org; s=openmailbox; t=1473796468; bh=/I/ww3bY2IMBs0XBpptQxqA2pYWQkuHypgeBDTGSoJc=; h=To:From:Subject:Date:From; b=ZP/k+Rl6BidleKqvHTdKmvYGVEjKB7uIieI0SzjeeG96zEpv8OCtpwhxyFonr4aDH 2ZSYjrmLPE25y7LxuKtCLb0BxfoQRCtCTKqNSOqPBPj35fALtUR8JOf37Yh/p6yP6R rGPrCpRwt887T05ufDYABXXXlLzAi/dolGDJ6Tno= From: twilight Subject: What is the point in expression: !!var ? Message-ID: <7bf5cd37-6436-8cec-74e3-f0856bcc807c@openmailbox.org> Date: Tue, 13 Sep 2016 19:54:31 +0000 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Sep 2016 20:02:34 -0000 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.