Thread: "<?": I have no idea what this is

  1. #1
    Registered User
    Join Date
    Jun 2008
    Posts
    3

    "<?": I have no idea what this is

    I was reading some code and found this line:

    mil[j+1] = mil[j] <? res[j];

    What the "<?" mean? My first guess would be a conditional, like in "a<b?c:d", but the < is a binary operator, so it doesn't make much sense.

    Thanks.

  2. #2

    Join Date
    Apr 2008
    Location
    USA
    Posts
    76
    I believe that's shorthand for:

    Code:
    mil [j + 1] = mil [j] < res [j] ? mil [j] : res [j];
    i.e. it returns the lesser of the two values.

  3. #3
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    It is a compiler extension for gcc, and is not standard C++. I also think it means exactly what you guessed it means. It's just shorthand.

  4. #4
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,318
    Interesting, well I certainly learnt something today. I guess >? works too? What about <=? etc?
    Of course on most compilers it's what we call a "syntax error".
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

  5. #5
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    They're all deprecated and may have even be removed in 4.3. I think I remember something to that effect in the changelog.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. project idea ???
    By gemini_shooter in forum C Programming
    Replies: 2
    Last Post: 06-09-2005, 09:56 AM
  2. Have an idea?
    By B0bDole in forum Projects and Job Recruitment
    Replies: 46
    Last Post: 01-13-2005, 03:25 PM
  3. A little problem about an idea, help please
    By louis_mine in forum C++ Programming
    Replies: 3
    Last Post: 09-10-2004, 09:52 PM
  4. totally screwed up idea
    By iain in forum A Brief History of Cprogramming.com
    Replies: 9
    Last Post: 08-17-2001, 12:09 PM