git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Re: Re: Re: Remove need to untrack before tracking new branch

From
MSMartin Schlemmer <azarah@nosferatu.za.org>
Date
Apr 15, 2005, 05:45 UTC
Message-ID
<1113543914.23299.151.camel@nosferatu.lan>
In-Reply-To
<81b0412b0504141535793cc235@mail.gmail.com>
On Fri, 2005-04-15 at 00:35 +0200, Alex Riesen wrote:
Show 7 quoted lines
> On 4/14/05, Martin Schlemmer <azarah@nosferatu.za.org> 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
Previous: Alex RiesenNext: Paul Jackson
Message 9 of 16 in “Re: Re: Re: Remove need to untrack before tracking new branch”
  1. Petr BaudisApr 13, 2005
  2. Martin SchlemmerApr 14, 2005
  3. Martin SchlemmerApr 14, 2005
  4. Martin SchlemmerApr 14, 2005
  5. Petr BaudisApr 14, 2005
  6. Martin SchlemmerApr 14, 2005
  7. Martin SchlemmerApr 14, 2005
  8. Alex RiesenApr 14, 2005
  9. Martin SchlemmerApr 15, 2005
  10. Paul JacksonApr 15, 2005
  11. Alex RiesenApr 15, 2005
  12. Petr BaudisApr 14, 2005
  13. Martin SchlemmerApr 14, 2005
  14. Petr BaudisApr 14, 2005
  15. Martin SchlemmerApr 14, 2005
  16. Martin SchlemmerApr 14, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.