Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Just FUN :D
Forum Updated to NodeBB v4.3 + New Features

Just FUN :D

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 838 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jafarabadi.qt
    wrote on last edited by
    #1

    Hi dears, please look this...

    @
    if ( false==false==false )
    qDebug()<<"Ding Ding !"; //UNREACHABLE CODE
    @

    i think that it should be ok and print my message because of
    FALSE is FALSE and FALSE will be FALSE!!!
    compiler work with it's result which it returned. but why?
    i know we need the result for if but... let's speak about it...

    1 Reply Last reply
    0
    • JeroentjehomeJ Offline
      JeroentjehomeJ Offline
      Jeroentjehome
      wrote on last edited by
      #2

      Hi,
      Off course this compiles (will give Wparentheses warning). The result will be not printing the output! Very simpel, the == operator does a compare of the first two elements (false==false) this will return true. Then do the compare of true==false -> result false, so your code does:
      if (false)
      {
      }
      So this does not work and will not print the output

      Greetz, Jeroen

      1 Reply Last reply
      0
      • K Offline
        K Offline
        Kasal
        wrote on last edited by
        #3

        That's great! So if FFF is false, test FTF, you'll be surprised!
        How does a brain works to find such things!
        Very amusing.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved