[ros-dev] [ros-diffs] [dgorbachev] 39422: Fix bug #4129 in CmpGetNameControlBlock().

Timo Kreuzer timo.kreuzer at web.de
Tue Feb 17 00:29:38 CET 2009


James Hawkins schrieb:
> On Mon, Feb 16, 2009 at 12:54 PM, Timo Kreuzer <timo.kreuzer at web.de> wrote:
>   
>> Zachary Gorden schrieb:
>>     
>>> I agree with the requirement for the parenthesis, simply because it helps
>>> separate the various conditions that are being tested for.  Even looking at
>>>
>>>       
>> The conditions are clearly seperated by || or by &&. It should be
>> instantly clear that the comparison is higher than || and && in the
>> order of operations.
>> Something like "if (a == (b || c) > d)" wouldn't make sense anyway.
>>
>> Do not mess this up with bracing things like
>> if ((a == 0 || a > 2) && b < 0)
>> Although the braces are not needed, it makes sense to set them.
>>
>>     
>
> () -> parentheses
> [] -> brackets
> {} -> braces
>   
Hmm ok, good to know.
> The parentheses are not needed?  You better check your C book for
> operator precedence.  && has higher precedence than ||, so in this
> case the parentheses are needed.  This is also why using parentheses
> is a good idea, because you never know if the original author has any
> idea about operator precedence.  The use of parentheses makes the
> original intention clear to other authors.
>
>   
Sorry, of cause you are right. my fault. I initially wanted to write
something different, got it messed up.. ;-)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.reactos.org/pipermail/ros-dev/attachments/20090217/078689b8/attachment.html 


More information about the Ros-dev mailing list