Re: What is >?

Discussion in 'C++' started by SG, Mar 26, 2013.

  1. SG

    SG Guest

    Am 26.03.2013 15:37, schrieb Blake McBride:
    > lbuf = lbuf >? x;
    > xda = 0 >? cda;
    > indent = indent >? 0;
    >
    > This construct is used in several places. It don't think it is noise
    > becasue ">" is used elsewhere without "?".


    It's the max operator from the old G++ 3.x.x
    http://gcc.gnu.org/onlinedocs/gcc-3.4.6/gcc/Min-and-Max.html

    a >? b

    was short for

    a > b ? a : b

    with the exception of evaluating the operand expressions only once.
    Since this was a compiler extension that has been removed a couple of
    years ago, you get the code to compile, by making sure you've included
    the <algorithm> header and using

    std::max(a,b)

    instead.
    SG, Mar 26, 2013
    #1
    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.

Share This Page