Doing both functions in &&

Discussion in 'C++' started by EvilOldGit@googlemail.com, Apr 13, 2007.

  1. Guest

    Is it defined in the standard that when evaluating && that if the
    first operand is false it doesn't bother operating the other ?
    Ditto ||
     
    , Apr 13, 2007
    #1
    1. Advertising

  2. wrote:
    > Is it defined in the standard that when evaluating && that if the
    > first operand is false it doesn't bother operating the other ?
    > Ditto ||


    Yes.

    V
    --
    Please remove capital 'A's when replying by e-mail
    I do not respond to top-posted replies, please don't ask
     
    Victor Bazarov, Apr 13, 2007
    #2
    1. Advertising

  3. Default User Guest

    wrote:

    > Is it defined in the standard that when evaluating && that if the
    > first operand is false it doesn't bother operating the other ?


    Yes, it's called short-circuit evaluation.

    > Ditto ||


    Well, something similar. If the first operand is true, it doesn't
    bother with the second.




    Brian
     
    Default User, Apr 13, 2007
    #3
  4. Andre Kostur Guest

    "Victor Bazarov" <> wrote in news:evorvm$9t$1
    @news.datemas.de:

    > wrote:
    >> Is it defined in the standard that when evaluating && that if the
    >> first operand is false it doesn't bother operating the other ?
    >> Ditto ||

    >
    > Yes.


    Unless operator&& is a user-defined operator. (I know, doesn't help for
    basic types....)
     
    Andre Kostur, Apr 14, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. tshad
    Replies:
    11
    Views:
    830
    tshad
    May 27, 2005
  2. Xiangliang Meng
    Replies:
    1
    Views:
    1,629
    Victor Bazarov
    Jun 21, 2004
  3. Peter Olcott
    Replies:
    4
    Views:
    348
    Markus Schoder
    Jun 4, 2006
  4. ABCL
    Replies:
    0
    Views:
    566
  5. Victor Hooi
    Replies:
    7
    Views:
    143
    Mitya Sirenef
    Mar 29, 2013
Loading...

Share This Page