From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4418 invoked by alias); 5 May 2011 18:29:53 -0000 Received: (qmail 4407 invoked by uid 22791); 5 May 2011 18:29:52 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 05 May 2011 18:29:39 +0000 Received: (qmail 7942 invoked from network); 5 May 2011 18:29:38 -0000 Received: from unknown (HELO ?192.168.1.2?) (kcy@127.0.0.2) by mail.codesourcery.com with ESMTPA; 5 May 2011 18:29:38 -0000 Message-ID: <4DC2EC8E.6080401@codesourcery.com> Date: Thu, 05 May 2011 18:29:00 -0000 From: Kwok Cheung Yeung User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 MIME-Version: 1.0 To: Pedro Alves CC: gdb-patches@sourceware.org Subject: Re: [PATCH] Support for enabling/disabling tracepoints while a trace experiment is running References: <4DC2DDEF.10600@codesourcery.com> <201105051848.15560.pedro@codesourcery.com> In-Reply-To: <201105051848.15560.pedro@codesourcery.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-05/txt/msg00153.txt.bz2 On 05/05/2011 18:48, Pedro Alves wrote: >> + if ((enable && tp->enabled) || (!enable && !tp->enabled)) > > but isn't this just: > > if (enable != tp->enabled) > > ? > In this case it is, since enable and tp->enabled can only take the values 0 and 1. However, 'true' in C is 'non-zero' - 1 and ~0 are both non-zero and therefore 'true', but they aren't equal. The first version would get the boolean comparison correct if there were multiple values of 'true' being used, whereas the second would not. Kwok