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

Kwok Cheung Yeung kcy@codesourcery.com
Thu May 5 18:29:00 GMT 2011


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



More information about the Gdb-patches mailing list