Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. Making sure something is really true.....

Making sure something is really true.....

Scheduled Pinned Locked Moved The Weird and The Wonderful
8 Posts 7 Posters 0 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.
  • N Offline
    N Offline
    Nathan D Cook
    wrote on last edited by
    #1

    saw this at work today.... if (Status == "something") { randomValue = true; } else { randomValue = true; } That was it. No other code in that if/else statement. :-D

    G A B R S 6 Replies Last reply
    0
    • N Nathan D Cook

      saw this at work today.... if (Status == "something") { randomValue = true; } else { randomValue = true; } That was it. No other code in that if/else statement. :-D

      G Offline
      G Offline
      gavindon
      wrote on last edited by
      #2

      there is no doubt that randomValue is definitively true.

      Programming is a race between programmers trying to build bigger and better idiot proof programs, and the universe trying to build bigger and better idiots, so far... the universe is winning.

      1 Reply Last reply
      0
      • N Nathan D Cook

        saw this at work today.... if (Status == "something") { randomValue = true; } else { randomValue = true; } That was it. No other code in that if/else statement. :-D

        A Offline
        A Offline
        AspDotNetDev
        wrote on last edited by
        #3

        There is undoubtedly another DLL that inspects this DLL's IL to ensure the code has not been tampered with. If it finds that somebody removed the seemingly extraneous if statement, it will cause ThreadAbortExceptions at random intervals. ;P

        [

        S<T>::f(U) // Out of line.

        ](http://msdn.microsoft.com/en-us/library/8yk3t00s(v=vs.71).aspx)

        G 1 Reply Last reply
        0
        • A AspDotNetDev

          There is undoubtedly another DLL that inspects this DLL's IL to ensure the code has not been tampered with. If it finds that somebody removed the seemingly extraneous if statement, it will cause ThreadAbortExceptions at random intervals. ;P

          [

          S<T>::f(U) // Out of line.

          ](http://msdn.microsoft.com/en-us/library/8yk3t00s(v=vs.71).aspx)

          G Offline
          G Offline
          gavindon
          wrote on last edited by
          #4

          :laugh:

          Programming is a race between programmers trying to build bigger and better idiot proof programs, and the universe trying to build bigger and better idiots, so far... the universe is winning.

          1 Reply Last reply
          0
          • N Nathan D Cook

            saw this at work today.... if (Status == "something") { randomValue = true; } else { randomValue = true; } That was it. No other code in that if/else statement. :-D

            B Offline
            B Offline
            BillW33
            wrote on last edited by
            #5

            I am going to guess that one of those blocks should be setting randomValue = false. If so I would prefer this much simplier version: randomValue = status == "something"; However, when I see code like that I have to check everything around it for correct logic. :(

            Just because the code works, it doesn't mean that it is good code.

            1 Reply Last reply
            0
            • N Nathan D Cook

              saw this at work today.... if (Status == "something") { randomValue = true; } else { randomValue = true; } That was it. No other code in that if/else statement. :-D

              R Offline
              R Offline
              R Erasmus
              wrote on last edited by
              #6

              Setting a random value to true... that is very random.

              "Program testing can be used to show the presence of bugs, but never to show their absence." << please vote!! >>

              1 Reply Last reply
              0
              • N Nathan D Cook

                saw this at work today.... if (Status == "something") { randomValue = true; } else { randomValue = true; } That was it. No other code in that if/else statement. :-D

                S Offline
                S Offline
                Sterling Camden independent consultant
                wrote on last edited by
                #7

                I'll guess that this code has been significantly reorganized and these are the only statements left from a major cutback. Otherwise, we must assume that the author is insane.

                Contains coding, but not narcotic.

                1 Reply Last reply
                0
                • N Nathan D Cook

                  saw this at work today.... if (Status == "something") { randomValue = true; } else { randomValue = true; } That was it. No other code in that if/else statement. :-D

                  T Offline
                  T Offline
                  TorstenFrings
                  wrote on last edited by
                  #8

                  there is an obvious flaw in this code, it should read like:

                  if (Status == "something")
                  {
                  randomValue = true;
                  }
                  else if (Status != "something")
                  {
                  randomValue = true;
                  }
                  else
                  {
                  randomValue = true;
                  }

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups