This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Support for enabling/disabling tracepoints while a trace experiment is running


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]