Thread: macro comparison syntax

  1. #1
    Registered User
    Join Date
    Jul 2004
    Posts
    222

    macro comparison syntax

    For the line below, is there an easy way for me to add a 3rd condition for the case pos == actual_depth? What is the ? ... : ... called?

    Code:
    actual_depth += (pos > actual_depth ? 1: -1);

  2. #2
    Registered User
    Join Date
    Oct 2008
    Posts
    1,262
    Quote Originally Posted by stanlvw View Post
    For the line below, is there an easy way for me to add a 3rd condition for the case pos == actual_depth? What is the ? ... : ... called?

    Code:
    actual_depth += (pos > actual_depth ? 1: -1);
    It's called the ternary operator. And it's possible like this:
    Code:
    actual_depth += (pos > actual_depth ? 1: (pos == actual_depth ? WHATEVER : -1));

  3. #3
    Registered User
    Join Date
    Jul 2004
    Posts
    222
    Thanks for the answer and suggestion.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. more then 100errors in header
    By hallo007 in forum Windows Programming
    Replies: 20
    Last Post: 05-13-2007, 08:26 AM
  2. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  3. Using VC Toolkit 2003
    By Noobwaker in forum Windows Programming
    Replies: 8
    Last Post: 03-13-2006, 07:33 AM
  4. Connecting to a mysql server and querying problem
    By Diod in forum C++ Programming
    Replies: 8
    Last Post: 02-13-2006, 10:33 AM
  5. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM