Menu

#66 boolean operators don't have early exit semantics

open
nobody
None
1
2004-02-06
2004-02-06
No

NASM supports the &&, ^^, and || operators, which
perform a boolean AND, XOR, and OR, respectively.

However -- unlike C -- NASM does not support early
exit semantics for those operators. For example:

%define one 1
%if ( one==1 ) || ( two==2 )
true
%else
false
%endif

This will fail because "two" hasn't been defined,
even though the "one==1" part is true, i.e. even
though the "two==2" part doesn't need evalution.

So far I believe that this behavior is acceptable
as long as it gets documented in the user manual.

Discussion

  • nasm64developer

    nasm64developer - 2004-02-06
    • priority: 5 --> 1
     
  • nasm64developer

    nasm64developer - 2004-03-13
     
  • nasm64developer

    nasm64developer - 2004-03-13

    Logged In: YES
    user_id=804543

    In my local forked version I've added support for
    early exit semantics to the || and && operators.

    Attached find the necessary changes and testcases.

     
  • nasm64developer

    nasm64developer - 2004-03-13
     
  • nasm64developer

    nasm64developer - 2004-03-13

    Logged In: YES
    user_id=804543

    Btw, early exit semantics don't apply to the ^^ operator.

     
  • nasm64developer

    nasm64developer - 2007-09-23

    Logged In: YES
    user_id=804543
    Originator: YES

    effectively this has turned from a doc/support
    request into a feature request

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.