Thread: tertiary comparison

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Obsessed with C chrismiceli's Avatar
    Join Date
    Jan 2003
    Posts
    501
    Well, it was expanding to be quite long. x, y, z are all really members of structs and expanding each one took multiple lines. I was just wondering, I can work with no other solution, just curious. Thanks.
    Help populate a c/c++ help irc channel
    server: irc://irc.efnet.net
    channel: #c

  2. #2
    Registered User
    Join Date
    Jun 2004
    Posts
    84
    Quote Originally Posted by chrismiceli
    Well, it was expanding to be quite long. x, y, z are all really members of structs and expanding each one took multiple lines. I was just wondering, I can work with no other solution, just curious. Thanks.
    Well... if your structures are _that_ long and you don't like writing, you can put values in temp vars and hope that compiler will optimize them away.
    Code:
    {
      int tempX = x;
      int tempY = y;
      int tempZ = z;
      if (tempX == tempY && tempY == tempZ && tempZ != a)
      {
        //code
      }
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 26
    Last Post: 07-05-2010, 10:43 AM
  2. std::string comparison versus int comparison
    By leeor_net in forum C++ Programming
    Replies: 3
    Last Post: 04-12-2009, 07:28 AM
  3. Bug in iterator comparison in C++ standard?
    By steev in forum C++ Programming
    Replies: 14
    Last Post: 07-12-2008, 12:02 AM
  4. Binary comparison
    By tao in forum Windows Programming
    Replies: 0
    Last Post: 06-28-2006, 12:10 PM
  5. comparison between pointer and integer
    By bazzano in forum C Programming
    Replies: 3
    Last Post: 03-07-2006, 01:15 PM