what is the >? operator called

This is a discussion on what is the >? operator called within the C++ Programming forums, part of the General Programming Boards category; What is the >? operator called in the following code: Code: int a = 3, b=4, c=5; int r = ...

  1. #1
    Registered User
    Join Date
    Feb 2005
    Posts
    46

    what is the >? operator called

    What is the >? operator called in the following code:

    Code:
    int a = 3, b=4, c=5;    
    int r = c <? b <? a;
    I can figure that it finds the minimum, but what is that operator called? It's different from the ternary operator, which I've seen before ( for ex. a>b?1:0 ).

  2. #2
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,514
    That operator doesn't exist in C++

    What you are seeing is a clever terse expression based on the ternary operator and the less-than operator
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  3. #3
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    Location
    Tehran
    Posts
    1,231
    On my compiler:
    error C2059: syntax error : '?'
    Why you can compile but I don't?
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

  4. #4
    Registered User
    Join Date
    Oct 2004
    Posts
    151
    It's a GCC-only extension for minimum/maximum.

    http://gcc.gnu.org/onlinedocs/gcc-3....ml#Min-and-Max
    System: Debian Sid and FreeBSD 7.0. Both with GCC 4.3.

    Useful resources:
    comp.lang.c FAQ | C++ FQA Lite

  5. #5
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,514
    Yup. I was looking through it, but couldn't find it anywhere. Thanks for clearing it out. I was wrong the first time.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  6. #6
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    Location
    Ireland
    Posts
    2,262
    It looks ugly (IMO), much more so than the ternary one, which I'm only sometimes fond of.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. small -> big -> bigger -> bigger than bigger -> ?
    By happyclown in forum A Brief History of Cprogramming.com
    Replies: 9
    Last Post: 03-11-2009, 12:12 PM
  2. Dev-C++ -> Tools - > Editor -> Syntax
    By Yuri2 in forum C++ Programming
    Replies: 19
    Last Post: 07-03-2006, 07:48 AM
  3. > > > Urgent Help < < <
    By CodeCypher in forum C Programming
    Replies: 2
    Last Post: 01-31-2006, 01:06 PM
  4. electricity > AC circuits > tesla coil
    By dbaryl in forum A Brief History of Cprogramming.com
    Replies: 17
    Last Post: 03-14-2002, 01:16 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21