Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Re: What is >?

Reply
Thread Tools

Re: What is >?

 
 
Victor Bazarov
Guest
Posts: n/a
 
      03-26-2013
On 3/26/2013 10:37 AM, Blake McBride wrote:
> I have an old editor written in C++ that I am trying to comple. It
> gives me an error on an operator ">?". I searched everywhere in that
> system and it is not defined anywhere. Couldn't find it in any C++ book
> I had. Google can't search on symbols. I believe the left and right
> arguments are int's. So it looks like this:
>
> 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 was (is?) a gnu C (and probably C++) extension that acted (acts?)
similarly to the ternary operator.

a >? b --> (a > b ? a : b)

a <? b --> (a < b ? a : b)

IIRC.

V
--
I do not respond to top-posted replies, please don't ask
 
Reply With Quote
 
 
 
 
army1987
Guest
Posts: n/a
 
      04-02-2013
On Tue, 26 Mar 2013 09:48:46 -0500, Blake McBride wrote:

> Thanks! Not being great at C++, can someone give me a definition of
> that operator to do what is shown below?


Please do not top-post.

expr1 ? expr2 : expr3 returns expr2 if expr1 is true, and expr3
otherwise. So

>> a >? b --> (a > b ? a : b)


returns a if a is greater than b, and b otherwise, i.e. the same as
std::max(a,b); likewise

>> a <? b --> (a < b ? a : b)


returns the same as std::min(a,b).

--
[ T H I S S P A C E I S F O R R E N T ]
Troppo poca cultura ci rende ignoranti, troppa ci rende folli.
-- fathermckenzie di it.cultura.linguistica.italiano
<http://xkcd.com/397/>
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments