From: clubley@remove_me.eisner.decus.org-Earth.UFP   
      
   On 2025-08-16, Arne Vajhøj wrote:   
   > On 8/15/2025 6:42 PM, Lawrence D?Oliveiro wrote:   
   >> On Fri, 15 Aug 2025 09:55:17 -0400, Arne Vajhøj wrote:   
   >>> But I believe most curly bracket languages inherited from C in this   
   >>> regard.   
   >>   
   >> Python took over the C operator hierarchy, with one subtle little   
   >> twist. It slightly tweaked the precedence of the bitwise operators   
   >> relative to the comparisons, so you don?t need parentheses in   
   >> expressions like   
   >>   
   >> (C) («val» & «bitmask») == «testvalue»   
   >> (Python) «val» & «bitmask» == «testvalue»   
   >>   
   >> I have asked on comp.lang.c whether any existing C code could be   
   >> broken by making the same change in that language. In principle it   
   >> could, but nobody could come up with any real-world examples.   
   >   
   > What about:   
   >   
   > if(reperr & sys$put(&rab, 0, 0) != RMS$_NORMAL)   
   > {   
   > printf("Houston we have a problem\n");   
   > }   
   >   
      
   And it's crap like that which means I tend to ignore operator precedence   
   and place all subexpressions in brackets (nested if needed).   
      
   It avoids stuff like this and makes it _extremely_ clear in the code   
   what the intention is (and makes it easier to read BTW).   
      
   Simon.   
      
   --   
   Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP   
   Walking destinations on a map are further away than they appear.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|