From: johnrreagan@earthlink.net   
      
   On 8/15/2025 7:48 PM, Arne Vajhøj wrote:   
   > On 8/15/2025 1:33 PM, Simon Clubley wrote:   
   >> On 2025-08-15, Dan Cross wrote:   
   >>> In article <107n93n$13rjm$1@dont-email.me>,   
   >>> Simon Clubley wrote:   
   >>>> On 2025-08-12, Arne Vajhøj wrote:   
   >>>>> if(args->arg_count == 2 && args->arg_type[0] == STRING_RESULT   
   &&   
   >>>>> args->arg_type[1] == INT_RESULT)   
   >>>>   
   >>>> Is it guaranteed that arg_type[] will always have at least elements ?   
   >>>> If not, that's dangerous unless the compiler you are using does   
   >>>> expression short-circuiting.   
   >>>   
   >>> C is well-defined in this regard. Boolean expressions in C,   
   >>> created by combining logical subexpressions with the `&&` and   
   >>> `||` operators, are documented to use short-circuiting behavior.   
   >   
   >> Unless it's explicit in the language syntax itself, and given that   
   >> I write code in multiple languages, I have long written code that   
   >> assumes implicit[*] short-circuiting is not available.   
   >>   
   >> As such, whether implicit short-circuiting is available or not is   
   >> not really that important to me, but I will admit I didn't realise   
   >> C had it.   
   >>   
   >> [*] By implicit short-circuiting I mean something that's only defined   
   >> in the language standard or implemented in a compiler, instead of some   
   >> explicit syntax in the language itself to state short-circuiting is   
   >> available.   
   >   
   > In general I like the idea of writing code in a way that does   
   > not require the reader to have memorized ten thousand things from   
   > the language spec.   
   >   
   > But I do not consider this a matter of remembering the specific   
   > details about an operator - I consider this a matter of remembering   
   > what operator a symbol represent.   
   >   
   > I consider "short circuiting AND" and "non short circuiting AND"   
   > to be two different operators.   
      
   BTW, while the C frontend always generates the "short-circuiting" AND   
   and OR intermediate opcodes, the GEM optimizer works to detect if that   
   is really needed. It is hoping to hoist something from the right-hand   
   side out of a loop (which happens more than you think) and on Itanium it   
   can even put both left and right in the same bundle if possible (which   
   doesn't happen all that much)   
   >   
   > And in C then && is the first operator not the second operator.   
   >   
   > And understanding what operator each symbol represent is not   
   > detail but core. IMHO.   
   >   
   > Arne   
   >   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|