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. Waiting for else part execution

Waiting for else part execution

Scheduled Pinned Locked Moved The Weird and The Wonderful
15 Posts 13 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.
  • M Madhanlal JM

    Today I came across the following code

    if (1=1){
    doSomeThing();
    }
    else{
    doBestThing();
    }

    I am waiting for the execution of else part :-D

    T Offline
    T Offline
    Tim Carmichael
    wrote on last edited by
    #2

    Quantum computing when all is possible at the same time?

    1 Reply Last reply
    0
    • M Madhanlal JM

      Today I came across the following code

      if (1=1){
      doSomeThing();
      }
      else{
      doBestThing();
      }

      I am waiting for the execution of else part :-D

      S Offline
      S Offline
      Sentenryu
      wrote on last edited by
      #3

      Madhanlal JM wrote:

      if (1=1){

      That does not even compile on any braced language i know of. ;P (yeah, i'm just nitpicking)

      S W 2 Replies Last reply
      0
      • M Madhanlal JM

        Today I came across the following code

        if (1=1){
        doSomeThing();
        }
        else{
        doBestThing();
        }

        I am waiting for the execution of else part :-D

        P Offline
        P Offline
        PIEBALDconsult
        wrote on last edited by
        #4

        I happened upon an if yesterday that was deactivated with: if ( false && ... :sigh: Personally, I prefer to build with warnings as errors, but this codebase throws thousands of warnings.

        This space intentionally left blank.

        1 Reply Last reply
        0
        • M Madhanlal JM

          Today I came across the following code

          if (1=1){
          doSomeThing();
          }
          else{
          doBestThing();
          }

          I am waiting for the execution of else part :-D

          Z Offline
          Z Offline
          ZurdoDev
          wrote on last edited by
          #5

          Luckily the Mayans were wrong or perhaps doBestThing() would have executed a couple of years ago.

          There are only 10 types of people in the world, those who understand binary and those who don't.

          1 Reply Last reply
          0
          • M Madhanlal JM

            Today I came across the following code

            if (1=1){
            doSomeThing();
            }
            else{
            doBestThing();
            }

            I am waiting for the execution of else part :-D

            B Offline
            B Offline
            bluesathish
            wrote on last edited by
            #6

            Madhanlal JM wrote:

            if(1=1){
            doSomeThing();
            }
            else{
            doBestThing();
            }

            I am waiting for the execution of else part

            if (1=1){ doSomeThing(); Goto l; } else{ l: doBestThing(); } Now the else part will run! Am I Correct? :)

            A 1 Reply Last reply
            0
            • B bluesathish

              Madhanlal JM wrote:

              if(1=1){
              doSomeThing();
              }
              else{
              doBestThing();
              }

              I am waiting for the execution of else part

              if (1=1){ doSomeThing(); Goto l; } else{ l: doBestThing(); } Now the else part will run! Am I Correct? :)

              A Offline
              A Offline
              Argonia
              wrote on last edited by
              #7

              I am not a goto expert(thank God) but i believe you have to define I before the Goto part.

              Microsoft ... the only place where VARIANT_TRUE != true

              S 1 Reply Last reply
              0
              • S Sentenryu

                Madhanlal JM wrote:

                if (1=1){

                That does not even compile on any braced language i know of. ;P (yeah, i'm just nitpicking)

                S Offline
                S Offline
                Super Lloyd
                wrote on last edited by
                #8

                well, it will compile for C and C++ at least! you young spring chicken! :P

                My programming get away... The Blog... DirectX for WinRT/C# since 2013! Taking over the world since 1371!

                Richard Andrew x64R S 2 Replies Last reply
                0
                • A Argonia

                  I am not a goto expert(thank God) but i believe you have to define I before the Goto part.

                  Microsoft ... the only place where VARIANT_TRUE != true

                  S Offline
                  S Offline
                  Super Lloyd
                  wrote on last edited by
                  #9

                  Argonia wrote:

                  I am not a goto expert(

                  I can see that.. of course you can go to to a label define after, in C, C++, C# at least!

                  My programming get away... The Blog... DirectX for WinRT/C# since 2013! Taking over the world since 1371!

                  1 Reply Last reply
                  0
                  • S Super Lloyd

                    well, it will compile for C and C++ at least! you young spring chicken! :P

                    My programming get away... The Blog... DirectX for WinRT/C# since 2013! Taking over the world since 1371!

                    Richard Andrew x64R Offline
                    Richard Andrew x64R Offline
                    Richard Andrew x64
                    wrote on last edited by
                    #10

                    Are you sure it will compile? '1' is not an l-value.

                    The difficult we do right away... ...the impossible takes slightly longer.

                    1 Reply Last reply
                    0
                    • S Super Lloyd

                      well, it will compile for C and C++ at least! you young spring chicken! :P

                      My programming get away... The Blog... DirectX for WinRT/C# since 2013! Taking over the world since 1371!

                      S Offline
                      S Offline
                      Sentenryu
                      wrote on last edited by
                      #11

                      I wont, you can't assign to an rvalue. UNLESS 1 is actually a macro that expands to something that makes sense on that context, but I don't even know if a macro can be called 1.

                      R 1 Reply Last reply
                      0
                      • M Madhanlal JM

                        Today I came across the following code

                        if (1=1){
                        doSomeThing();
                        }
                        else{
                        doBestThing();
                        }

                        I am waiting for the execution of else part :-D

                        L Offline
                        L Offline
                        Lost User
                        wrote on last edited by
                        #12

                        1 = 1 Or 1 - 1 = 0 Or 0 = 1 - 1

                        1 Reply Last reply
                        0
                        • M Madhanlal JM

                          Today I came across the following code

                          if (1=1){
                          doSomeThing();
                          }
                          else{
                          doBestThing();
                          }

                          I am waiting for the execution of else part :-D

                          N Offline
                          N Offline
                          NormDroid
                          wrote on last edited by
                          #13

                          Better saying if (1 = l) { } ... As this will throw a compiler error,

                          Web | News | LinkedIn

                          1 Reply Last reply
                          0
                          • S Sentenryu

                            Madhanlal JM wrote:

                            if (1=1){

                            That does not even compile on any braced language i know of. ;P (yeah, i'm just nitpicking)

                            W Offline
                            W Offline
                            W Balboos GHB
                            wrote on last edited by
                            #14

                            I'm digging deep into the past, but I believe that with MS QuickC, it may have allowed the compile. Upon execution, memory offset 1 would be overwritten with 1. Possibly an immediate crash, or more likely, a crash waiting to happen. I know it'd work with a cast to a pointer. QuickC was rather forgiving at times. Some of those times it was to my regret.

                            "The difference between genius and stupidity is that genius has its limits." - Albert Einstein

                            "As far as we know, our computer has never had an undetected error." - Weisert

                            "If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010

                            1 Reply Last reply
                            0
                            • S Sentenryu

                              I wont, you can't assign to an rvalue. UNLESS 1 is actually a macro that expands to something that makes sense on that context, but I don't even know if a macro can be called 1.

                              R Offline
                              R Offline
                              Rob Grainger
                              wrote on last edited by
                              #15

                              You cannot write a macro beginning with an digit.

                              "If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.

                              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