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. Someone please help me ....

Someone please help me ....

Scheduled Pinned Locked Moved The Weird and The Wonderful
c++rubyhelp
23 Posts 15 Posters 3 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 Offline
    M Offline
    Monty2
    wrote on last edited by
    #1

    ... have to work with people who wrote this GEM

    if(i==0)
    *outcallRecvCount = 0;
    else
    *outcallRecvCount = i ;

    :~


    C++ where friends have access to your private members !

    S B N C C 11 Replies Last reply
    0
    • M Monty2

      ... have to work with people who wrote this GEM

      if(i==0)
      *outcallRecvCount = 0;
      else
      *outcallRecvCount = i ;

      :~


      C++ where friends have access to your private members !

      S Offline
      S Offline
      StM0n
      wrote on last edited by
      #2

      eh... ahem... :wtf: you're using plural... so there's more than one...?

      (yes|no|maybe)*

      1 Reply Last reply
      0
      • M Monty2

        ... have to work with people who wrote this GEM

        if(i==0)
        *outcallRecvCount = 0;
        else
        *outcallRecvCount = i ;

        :~


        C++ where friends have access to your private members !

        B Offline
        B Offline
        BadKarma
        wrote on last edited by
        #3

        I don't actually see something wrong with this. I could be that that i changes between

        if(i==0)
        

        and

        *outcallRecvCount = i;
        

        But then they should have protected it with CRITICAL_SECTIONS ;P

        Learn from the mistakes of others, you may not live long enough to make them all yourself.

        D C 2 Replies Last reply
        0
        • M Monty2

          ... have to work with people who wrote this GEM

          if(i==0)
          *outcallRecvCount = 0;
          else
          *outcallRecvCount = i ;

          :~


          C++ where friends have access to your private members !

          N Offline
          N Offline
          Nagy Vilmos
          wrote on last edited by
          #4

          Gin for breakfast. That should sort it out.


          Panic, Chaos, Destruction. My work here is done.

          1 Reply Last reply
          0
          • M Monty2

            ... have to work with people who wrote this GEM

            if(i==0)
            *outcallRecvCount = 0;
            else
            *outcallRecvCount = i ;

            :~


            C++ where friends have access to your private members !

            C Offline
            C Offline
            Chris Meech
            wrote on last edited by
            #5

            It would have been clearer if the if ( ... ) had been expanded upon. You know something like this,

            if ( i == 0 && *outcallRecvCount != 0 )
            *outcallRecvCount = 0;
            else
            if ( i != *outcallRecvCount )
            *outcallRecvCount = i;

            There that's much clearer and couldn't possibly be considered a horror. :cool:

            Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]

            1 Reply Last reply
            0
            • M Monty2

              ... have to work with people who wrote this GEM

              if(i==0)
              *outcallRecvCount = 0;
              else
              *outcallRecvCount = i ;

              :~


              C++ where friends have access to your private members !

              C Offline
              C Offline
              CPallini
              wrote on last edited by
              #6

              That's legitimate, because the author needed

              *outcallRecvCount = 0;

              instead of

              *outcallRecvCount = 0 ;

              on

              i==0

              :-D

              If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
              This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
              [My articles]

              D 1 Reply Last reply
              0
              • M Monty2

                ... have to work with people who wrote this GEM

                if(i==0)
                *outcallRecvCount = 0;
                else
                *outcallRecvCount = i ;

                :~


                C++ where friends have access to your private members !

                G Offline
                G Offline
                geoffs
                wrote on last edited by
                #7

                Lovely! :doh: What is even more disgusting is that I've seen similar code in the product I am working on. You know, things like:

                if (thisBoolVar == true)
                {
                thatBoolVar = true;
                }
                else
                {
                thatBoolVar = false;
                }

                It is quite painful to have to be in areas of this code...

                B D 2 Replies Last reply
                0
                • G geoffs

                  Lovely! :doh: What is even more disgusting is that I've seen similar code in the product I am working on. You know, things like:

                  if (thisBoolVar == true)
                  {
                  thatBoolVar = true;
                  }
                  else
                  {
                  thatBoolVar = false;
                  }

                  It is quite painful to have to be in areas of this code...

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

                  And people ( especially non-programmers/managers ) don't understand why I say that just because it seems to work doesn't mean that it is good code. :) Bill W

                  G C 2 Replies Last reply
                  0
                  • B BillW33

                    And people ( especially non-programmers/managers ) don't understand why I say that just because it seems to work doesn't mean that it is good code. :) Bill W

                    G Offline
                    G Offline
                    geoffs
                    wrote on last edited by
                    #9

                    Very true. However, I don't want to make it seem like all managers are lumped into the non-programmer's category. Every so often, in some companies more than others, you'll have managers that are technically savvy and do understand the realities of the code base. It's a pleasure to work with these managers, even if they can't fix the world (because of the dictates of managers above them, etc).

                    B Y 2 Replies Last reply
                    0
                    • G geoffs

                      Very true. However, I don't want to make it seem like all managers are lumped into the non-programmer's category. Every so often, in some companies more than others, you'll have managers that are technically savvy and do understand the realities of the code base. It's a pleasure to work with these managers, even if they can't fix the world (because of the dictates of managers above them, etc).

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

                      I have to admit that is true. Some managers do understand, usually the ones that were programmers themselves, but sometimes the non-programmers do "get it". Bill W

                      1 Reply Last reply
                      0
                      • M Monty2

                        ... have to work with people who wrote this GEM

                        if(i==0)
                        *outcallRecvCount = 0;
                        else
                        *outcallRecvCount = i ;

                        :~


                        C++ where friends have access to your private members !

                        J Offline
                        J Offline
                        Joe Woodbury
                        wrote on last edited by
                        #11

                        There's a slim chance that the author was trimming some code now and had reason to believe additional code would be added. (Though a comment to that effect would have been useful.)

                        Anyone who thinks he has a better idea of what's good for people than people do is a swine. - P.J. O'Rourke

                        1 Reply Last reply
                        0
                        • M Monty2

                          ... have to work with people who wrote this GEM

                          if(i==0)
                          *outcallRecvCount = 0;
                          else
                          *outcallRecvCount = i ;

                          :~


                          C++ where friends have access to your private members !

                          L Offline
                          L Offline
                          Lonny clark
                          wrote on last edited by
                          #12

                          You must be new to this coding thing... you will see stuff that's far worse.

                          1 Reply Last reply
                          0
                          • G geoffs

                            Very true. However, I don't want to make it seem like all managers are lumped into the non-programmer's category. Every so often, in some companies more than others, you'll have managers that are technically savvy and do understand the realities of the code base. It's a pleasure to work with these managers, even if they can't fix the world (because of the dictates of managers above them, etc).

                            Y Offline
                            Y Offline
                            Yusuf
                            wrote on last edited by
                            #13

                            My first manager was technically savvy. He was a software engineer and has written many of the earlier versions of the software. It was lovely technical discussion. But he sucked as a manager / leader, just following orders from the top X| He would come and tell us what is going to happen and expresses his frustration and disagreements. poor fella, can't he fix the world? :rolleyes:

                            Yusuf

                            1 Reply Last reply
                            0
                            • M Monty2

                              ... have to work with people who wrote this GEM

                              if(i==0)
                              *outcallRecvCount = 0;
                              else
                              *outcallRecvCount = i ;

                              :~


                              C++ where friends have access to your private members !

                              P Offline
                              P Offline
                              Paul Conrad
                              wrote on last edited by
                              #14

                              :~ pretty much sums it up.

                              "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

                              1 Reply Last reply
                              0
                              • B BadKarma

                                I don't actually see something wrong with this. I could be that that i changes between

                                if(i==0)
                                

                                and

                                *outcallRecvCount = i;
                                

                                But then they should have protected it with CRITICAL_SECTIONS ;P

                                Learn from the mistakes of others, you may not live long enough to make them all yourself.

                                D Offline
                                D Offline
                                dojohansen
                                wrote on last edited by
                                #15

                                Well, IF the variable did change the code would make a bit more sense.... I believe what he meant was the pattern if (someCondition) doSomething(); else doExactlyTheSameThing();

                                1 Reply Last reply
                                0
                                • C CPallini

                                  That's legitimate, because the author needed

                                  *outcallRecvCount = 0;

                                  instead of

                                  *outcallRecvCount = 0 ;

                                  on

                                  i==0

                                  :-D

                                  If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                                  This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                                  [My articles]

                                  D Offline
                                  D Offline
                                  dojohansen
                                  wrote on last edited by
                                  #16

                                  Oh I see it's the space before the semi-colon...

                                  C 1 Reply Last reply
                                  0
                                  • G geoffs

                                    Lovely! :doh: What is even more disgusting is that I've seen similar code in the product I am working on. You know, things like:

                                    if (thisBoolVar == true)
                                    {
                                    thatBoolVar = true;
                                    }
                                    else
                                    {
                                    thatBoolVar = false;
                                    }

                                    It is quite painful to have to be in areas of this code...

                                    D Offline
                                    D Offline
                                    dojohansen
                                    wrote on last edited by
                                    #17

                                    We can build upon this!

                                    try
                                    {
                                    if (thisBoolVar == true? true : false)
                                    {
                                    thatBoolVar = (thisBoolVar != false? true : false);
                                    }
                                    else
                                    {
                                    thatBoolVar = (thisBoolVar == false? false : true);
                                    }
                                    }
                                    catch {}

                                    if (thatBoolVar != thisBoolVar) ...

                                    1 Reply Last reply
                                    0
                                    • D dojohansen

                                      Oh I see it's the space before the semi-colon...

                                      C Offline
                                      C Offline
                                      CPallini
                                      wrote on last edited by
                                      #18

                                      Exactly. :-D

                                      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                                      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                                      [My articles]

                                      1 Reply Last reply
                                      0
                                      • M Monty2

                                        ... have to work with people who wrote this GEM

                                        if(i==0)
                                        *outcallRecvCount = 0;
                                        else
                                        *outcallRecvCount = i ;

                                        :~


                                        C++ where friends have access to your private members !

                                        L Offline
                                        L Offline
                                        leonej_dt
                                        wrote on last edited by
                                        #19

                                        Resign now. Don't expose yourself to such level of idiocy, unless you really need the money. And if you can't resign, ensure you make your coworker feel "proud" enough of his achievement to never do such a thing again! Ok, don't be too harsh.

                                        To those who understand, I extend my hand. To the doubtful I demand: Take me as I am. Not under your command, I know where I stand. I won't change to fit yout plan. Take me as I am.

                                        1 Reply Last reply
                                        0
                                        • B BadKarma

                                          I don't actually see something wrong with this. I could be that that i changes between

                                          if(i==0)
                                          

                                          and

                                          *outcallRecvCount = i;
                                          

                                          But then they should have protected it with CRITICAL_SECTIONS ;P

                                          Learn from the mistakes of others, you may not live long enough to make them all yourself.

                                          C Offline
                                          C Offline
                                          cpkilekofp
                                          wrote on last edited by
                                          #20

                                          BadKarma wrote:

                                          But then they should have protected it with CRITICAL_SECTIONS

                                          There is only one situation where I would expect to see code like this: when one wants to set a breakpoint at i == 0 in the debugger, and one doesn't want to slow execution within the debugger by creating a conditional breakpoint.

                                          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