X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f Date: Sat, 04 May 2002 17:59:06 +0300 From: "Eli Zaretskii" Sender: halo1 AT zahav DOT net DOT il To: Martin Steuer Message-Id: <4949-Sat04May2002175905+0300-eliz@is.elta.co.il> X-Mailer: emacs 21.2.50 (via feedmail 8 I) and Blat ver 1.8.9 CC: djgpp AT delorie DOT com In-reply-to: <5.0.2.1.2.20020504135729.009e3690@pop.gmx.net> (message from Martin Steuer on Sat, 04 May 2002 14:04:32 +0200) Subject: Re: Can double negations get optimized out? References: <5 DOT 0 DOT 2 DOT 1 DOT 2 DOT 20020504135729 DOT 009e3690 AT pop DOT gmx DOT net> Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > Date: Sat, 04 May 2002 14:04:32 +0200 > From: Martin Steuer > > [...] > int a,b; > scanf("%d",&a); > b = !!a; > [...] > > I want to be sure that b can only be 1 or 0. Do i have to worry that this > is optimized out by a compiler? Yes, you should worry. What you want to say should be coded like this: b = a != 0;