On Fri, 2005-04-15 at 00:35 +0200, Alex Riesen wrote: > On 4/14/05, Martin Schlemmer <[EMAIL PROTECTED]> wrote: > > + if (update_mode && changed & MODE_CHANGED) > > + chmod(ce->name, ce->st_mode); > > it's "if ((update_mode && changed) & MODE_CHANGED)" > Did you really mean that? >
No, '&' have a higher priority (weight?) than '&&'. Although, yes, it might be better style to add brackets. But just to make you happy, let me prove it: ----- $ cat foo1.c int main() { int foo, bar; if (foo && bar & 1) return 1; return 0; } $ cat foo2.c int main() { int foo, bar; if (foo && (bar & 1)) return 1; return 0; } $ cat foo3.c int main() { int foo, bar; if ((foo && bar) & 1) return 1; return 0; } $ gcc -c -S foo1.c -o foo1.S $ gcc -c -S foo2.c -o foo2.S $ gcc -c -S foo3.c -o foo3.S $ diff -u foo1.S foo2.S --- foo1.S 2005-04-15 07:42:27.000000000 +0200 +++ foo2.S 2005-04-15 07:42:32.000000000 +0200 @@ -1,4 +1,4 @@ - .file "foo1.c" + .file "foo2.c" .text .globl main .type main, @function $ diff -u foo1.S foo3.S --- foo1.S 2005-04-15 07:42:27.000000000 +0200 +++ foo3.S 2005-04-15 07:42:35.000000000 +0200 @@ -1,4 +1,4 @@ - .file "foo1.c" + .file "foo3.c" .text .globl main .type main, @function @@ -9,9 +9,14 @@ andl $-16, %esp movl $0, %eax subl %eax, %esp + movl $0, -16(%ebp) cmpl $0, -4(%ebp) - je .L2 - movl -8(%ebp), %eax + je .L3 + cmpl $0, -8(%ebp) + je .L3 + movl $1, -16(%ebp) +.L3: + movl -16(%ebp), %eax andl $1, %eax testl %eax, %eax je .L2 ----- -- Martin Schlemmer
signature.asc
Description: This is a digitally signed message part