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. How to make thing more complicated for nothing...

How to make thing more complicated for nothing...

Scheduled Pinned Locked Moved The Weird and The Wonderful
devopstutorial
29 Posts 17 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 Maximilien

    in the same header file, 5 lines apart.

    #define szSTATUS_DONE "D"
    #define cSTATUS_DONE 'D'

    they represent the same status (and values) (yeah, we use type prefix !! :-( )

    CI/CD = Continuous Impediment/Continuous Despair

    S Offline
    S Offline
    Shmoken99
    wrote on last edited by
    #10

    Two devs and a deadline? Looks like the results of a yet another successful death march. Code works, mission accomplished.

    1 Reply Last reply
    0
    • J jochance

      The compiler told someone that string -> char was a type mismatch upon comparison so they added the other def and used that one. They did this for type mismatches for other values/variables too, sticking to their pattern. At least, that's my forensic analysis of the crime of a previous coder. A long time ago they were me, so we're intimate acquaintances without their knowing and I feel like I can predict some transgressions because I once made them. It's like catching your kids sneaking out, isn't it? Sleepover at Susie's! psssh...

      M Offline
      M Offline
      Mark Starr
      wrote on last edited by
      #11

      Yep: Empathy and understanding can lead to a more serene life. :omg:

      Time is the differentiation of eternity devised by man to measure the passage of human events. - Manly P. Hall Mark Just another cog in the wheel

      J 1 Reply Last reply
      0
      • M Mark Starr

        Yep: Empathy and understanding can lead to a more serene life. :omg:

        Time is the differentiation of eternity devised by man to measure the passage of human events. - Manly P. Hall Mark Just another cog in the wheel

        J Offline
        J Offline
        jochance
        wrote on last edited by
        #12

        Yeah I don't intend to be ugly about it. What else is everyone in the raft supposed to do when someone says they'll prioritize themselves ahead as much as they want to everyone else's detriment?

        D 1 Reply Last reply
        0
        • M Maximilien

          in the same header file, 5 lines apart.

          #define szSTATUS_DONE "D"
          #define cSTATUS_DONE 'D'

          they represent the same status (and values) (yeah, we use type prefix !! :-( )

          CI/CD = Continuous Impediment/Continuous Despair

          E Offline
          E Offline
          englebart
          wrote on last edited by
          #13

          const char const *szSTATUS_DONE = "D";
          const char cSTATUS_DONE = *szSTATUS_DONE;

          This will make you feel better…

          M 1 Reply Last reply
          0
          • E englebart

            const char const *szSTATUS_DONE = "D";
            const char cSTATUS_DONE = *szSTATUS_DONE;

            This will make you feel better…

            M Offline
            M Offline
            Maximilien
            wrote on last edited by
            #14

            lol. (heart attack)

            CI/CD = Continuous Impediment/Continuous Despair

            1 Reply Last reply
            0
            • M Maximilien

              in the same header file, 5 lines apart.

              #define szSTATUS_DONE "D"
              #define cSTATUS_DONE 'D'

              they represent the same status (and values) (yeah, we use type prefix !! :-( )

              CI/CD = Continuous Impediment/Continuous Despair

              T Offline
              T Offline
              trønderen
              wrote on last edited by
              #15

              I frequently define two representations of the same status, error or whatever, although usually an enum and a text string, rather than a char and a text string. From the old days, I like switch()-ing on scalars, not on strings or whatever. Besides, the switch variable is language independent, while the text string is language dependent. The question is whether the two representations should be kept together, which may seem like a good idea for maintenance purposes. Then you must keep all the language variants of the string in the same place, and they must have different names. Or you separate them, which makes maintenance more difficult, but you can keep all the Norwegian strings together, the German strings together and so on. Maybe they are even referenced by the same name. Then, if you add another status/error/... code, you have to look up all the different places where strings are defined, to make sure that you have a string version in all supported languages. Usually that is not a issue to consider in USA software: Who would ever want any other language than English?

              1 Reply Last reply
              0
              • J jochance

                Yeah I don't intend to be ugly about it. What else is everyone in the raft supposed to do when someone says they'll prioritize themselves ahead as much as they want to everyone else's detriment?

                D Offline
                D Offline
                Daniel Pfeffer
                wrote on last edited by
                #16

                jochance wrote:

                What else is everyone in the raft supposed to do when someone says they'll prioritize themselves ahead as much as they want to everyone else's detriment?

                The rest of the survivors eat them first? :)

                Freedom is the freedom to say that two plus two make four. If that is granted, all else follows. -- 6079 Smith W.

                1 Reply Last reply
                0
                • M Maximilien

                  in the same header file, 5 lines apart.

                  #define szSTATUS_DONE "D"
                  #define cSTATUS_DONE 'D'

                  they represent the same status (and values) (yeah, we use type prefix !! :-( )

                  CI/CD = Continuous Impediment/Continuous Despair

                  0 Offline
                  0 Offline
                  0x01AA
                  wrote on last edited by
                  #17

                  All c++ header #define are a PITA Why I should help the compiler to do it's job? I love c++ but I hate it also for the above....

                  1 Reply Last reply
                  0
                  • M Maximilien

                    in the same header file, 5 lines apart.

                    #define szSTATUS_DONE "D"
                    #define cSTATUS_DONE 'D'

                    they represent the same status (and values) (yeah, we use type prefix !! :-( )

                    CI/CD = Continuous Impediment/Continuous Despair

                    R Offline
                    R Offline
                    Ravi Bhavnani
                    wrote on last edited by
                    #18

                    Maximilien wrote:

                    they represent the same status (and values)

                    They may represent the same status but they certainly don't represent the same values.  One is a string while the other is a character. /ravi

                    My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com

                    M 1 Reply Last reply
                    0
                    • R Ravi Bhavnani

                      Maximilien wrote:

                      they represent the same status (and values)

                      They may represent the same status but they certainly don't represent the same values.  One is a string while the other is a character. /ravi

                      My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com

                      M Offline
                      M Offline
                      Maximilien
                      wrote on last edited by
                      #19

                      obviously. :-\

                      CI/CD = Continuous Impediment/Continuous Despair

                      1 Reply Last reply
                      0
                      • M Maximilien

                        in the same header file, 5 lines apart.

                        #define szSTATUS_DONE "D"
                        #define cSTATUS_DONE 'D'

                        they represent the same status (and values) (yeah, we use type prefix !! :-( )

                        CI/CD = Continuous Impediment/Continuous Despair

                        J Offline
                        J Offline
                        jschell
                        wrote on last edited by
                        #20

                        I had to work on a code base with a static code checker enforcement. And if you used a 'constant' more than twice it would flag it. Static code checkers are absolutely worthless.

                        T 1 Reply Last reply
                        0
                        • J jschell

                          I had to work on a code base with a static code checker enforcement. And if you used a 'constant' more than twice it would flag it. Static code checkers are absolutely worthless.

                          T Offline
                          T Offline
                          trønderen
                          wrote on last edited by
                          #21

                          jschell wrote:

                          Static code checkers are absolutely worthless.

                          You must have encountered an (or several) really bad code checkers. Some of them are really good. On the other hand: The good ones are far from cheap. You get what you pay for. Also, all the ones I have been in touch with, from the very top down to simple lint, has provided mechanisms for suppressing reports on each specific 'defect'. I see no viable justification for treating >2 uses of constant as a defect, so I would disable that test immediately.

                          Religious freedom is the freedom to say that two plus two make five.

                          J 1 Reply Last reply
                          0
                          • M Mircea Neacsu

                            Trust me, it's much worse when you go through your own's and go: "What was I thinking!" :laugh:

                            Mircea

                            A Offline
                            A Offline
                            aero smart
                            wrote on last edited by
                            #22

                            thanks for your information

                            1 Reply Last reply
                            0
                            • T trønderen

                              jschell wrote:

                              Static code checkers are absolutely worthless.

                              You must have encountered an (or several) really bad code checkers. Some of them are really good. On the other hand: The good ones are far from cheap. You get what you pay for. Also, all the ones I have been in touch with, from the very top down to simple lint, has provided mechanisms for suppressing reports on each specific 'defect'. I see no viable justification for treating >2 uses of constant as a defect, so I would disable that test immediately.

                              Religious freedom is the freedom to say that two plus two make five.

                              J Offline
                              J Offline
                              jschell
                              wrote on last edited by
                              #23

                              trønderen wrote:

                              Some of them are really good

                              None of them can be that good by their very nature. They can only look for simple problems. And that is only appropriate with a lot of junior programmers and with little, poor or non-existent code reviews. Often the problems are stylistic in nature as well. Complex real bugs originate from execution flow which static code checkers cannot detect at all.

                              trønderen wrote:

                              mechanisms for suppressing reports on each specific 'defect'.

                              However they are put in place in the context of process. So people fixate on the process and will not allow that. As I have encountered multiple times. They fixate on the idea that it is 'better' without understanding what is going on.

                              trønderen wrote:

                              down to simple lint,

                              I worked at hard core linux/unix C and C++ shops along with reading tech journals for years. And far as I recall no one ever considered lint to be a good idea.

                              trønderen wrote:

                              You get what you pay for.

                              It was a paid product.

                              K T Greg UtasG 3 Replies Last reply
                              0
                              • J jschell

                                trønderen wrote:

                                Some of them are really good

                                None of them can be that good by their very nature. They can only look for simple problems. And that is only appropriate with a lot of junior programmers and with little, poor or non-existent code reviews. Often the problems are stylistic in nature as well. Complex real bugs originate from execution flow which static code checkers cannot detect at all.

                                trønderen wrote:

                                mechanisms for suppressing reports on each specific 'defect'.

                                However they are put in place in the context of process. So people fixate on the process and will not allow that. As I have encountered multiple times. They fixate on the idea that it is 'better' without understanding what is going on.

                                trønderen wrote:

                                down to simple lint,

                                I worked at hard core linux/unix C and C++ shops along with reading tech journals for years. And far as I recall no one ever considered lint to be a good idea.

                                trønderen wrote:

                                You get what you pay for.

                                It was a paid product.

                                K Offline
                                K Offline
                                kalberts
                                wrote on last edited by
                                #24

                                To me, it seems obvious that you never have been in touch with a high quality static code analyzer. It also sounds like you most likely would turn down an offer to try a good one, because you know in advance that no good analyzers can exist. So it is a waste of time. You are in your full right to think so. I am in my full right to disagree with you.

                                1 Reply Last reply
                                0
                                • J jschell

                                  trønderen wrote:

                                  Some of them are really good

                                  None of them can be that good by their very nature. They can only look for simple problems. And that is only appropriate with a lot of junior programmers and with little, poor or non-existent code reviews. Often the problems are stylistic in nature as well. Complex real bugs originate from execution flow which static code checkers cannot detect at all.

                                  trønderen wrote:

                                  mechanisms for suppressing reports on each specific 'defect'.

                                  However they are put in place in the context of process. So people fixate on the process and will not allow that. As I have encountered multiple times. They fixate on the idea that it is 'better' without understanding what is going on.

                                  trønderen wrote:

                                  down to simple lint,

                                  I worked at hard core linux/unix C and C++ shops along with reading tech journals for years. And far as I recall no one ever considered lint to be a good idea.

                                  trønderen wrote:

                                  You get what you pay for.

                                  It was a paid product.

                                  T Offline
                                  T Offline
                                  trønderen
                                  wrote on last edited by
                                  #25

                                  jschell wrote:

                                  None of them can be that good by their very nature. They can only look for simple problems.

                                  It seems quite obvious to me that you have never been introduced to a high quality static analyzer. It seems to me that if you were offered an opportunity to try out an advanced code analyzer you might reject it as a waste of time, because you know in advance that such animals do not exist. You are in your full right to think so. And I am in my full right to disagree with you.

                                  Religious freedom is the freedom to say that two plus two make five.

                                  J 1 Reply Last reply
                                  0
                                  • J jschell

                                    trønderen wrote:

                                    Some of them are really good

                                    None of them can be that good by their very nature. They can only look for simple problems. And that is only appropriate with a lot of junior programmers and with little, poor or non-existent code reviews. Often the problems are stylistic in nature as well. Complex real bugs originate from execution flow which static code checkers cannot detect at all.

                                    trønderen wrote:

                                    mechanisms for suppressing reports on each specific 'defect'.

                                    However they are put in place in the context of process. So people fixate on the process and will not allow that. As I have encountered multiple times. They fixate on the idea that it is 'better' without understanding what is going on.

                                    trønderen wrote:

                                    down to simple lint,

                                    I worked at hard core linux/unix C and C++ shops along with reading tech journals for years. And far as I recall no one ever considered lint to be a good idea.

                                    trønderen wrote:

                                    You get what you pay for.

                                    It was a paid product.

                                    Greg UtasG Offline
                                    Greg UtasG Offline
                                    Greg Utas
                                    wrote on last edited by
                                    #26

                                    jschell wrote:

                                    Often the problems are stylistic in nature as well.

                                    It must be possible to disable a lot of the warnings about "code smells" based on things like the C++ Core Guidelines and MISRA. Some of these act as if everyone started development inh C++20, exaggerate their importance, and lead to so many warnings as to make the tool useless. As you say, it gets out of hand if people focus on process--the metrics that these tools spit out--without assessing whether the code really needs to change.

                                    jschell wrote:

                                    Complex real bugs originate from execution flow which static code checkers cannot detect at all.

                                    Coverity and Sonarcloud both highlight execution flows that could lead to the use of a null pointer. For example, they'll tell you that if the following 6 branches are taken, you could end up using an invalid pointer. In some cases, they even detect it across a chain of function calls. Perhaps you don't call this static analysis, because it actually analyzes execution flows, but both of these are classified as static analysis tools. Some warnings can be false positives for reasons that the tool can't understand, but they're worth investigating.

                                    Robust Services Core | Software Techniques for Lemmings | Articles
                                    The fox knows many things, but the hedgehog knows one big thing.

                                    <p><a href="https://github.com/GregUtas/robust-services-core/blob/master/README.md">Robust Services Core</a>
                                    <em>The fox knows many things, but the hedgehog knows one big thing.</em></p>

                                    J 1 Reply Last reply
                                    0
                                    • T trønderen

                                      jschell wrote:

                                      None of them can be that good by their very nature. They can only look for simple problems.

                                      It seems quite obvious to me that you have never been introduced to a high quality static analyzer. It seems to me that if you were offered an opportunity to try out an advanced code analyzer you might reject it as a waste of time, because you know in advance that such animals do not exist. You are in your full right to think so. And I am in my full right to disagree with you.

                                      Religious freedom is the freedom to say that two plus two make five.

                                      J Offline
                                      J Offline
                                      jschell
                                      wrote on last edited by
                                      #27

                                      trønderen wrote:

                                      that you have never been introduced to a high quality static analyzer.

                                      Perhaps. You can suggest one if you wish. I have however, as a principle programmer, been tasked with fixing many bugs which have shown up in production and none of which a static analyzer could have detected.

                                      1 Reply Last reply
                                      0
                                      • Greg UtasG Greg Utas

                                        jschell wrote:

                                        Often the problems are stylistic in nature as well.

                                        It must be possible to disable a lot of the warnings about "code smells" based on things like the C++ Core Guidelines and MISRA. Some of these act as if everyone started development inh C++20, exaggerate their importance, and lead to so many warnings as to make the tool useless. As you say, it gets out of hand if people focus on process--the metrics that these tools spit out--without assessing whether the code really needs to change.

                                        jschell wrote:

                                        Complex real bugs originate from execution flow which static code checkers cannot detect at all.

                                        Coverity and Sonarcloud both highlight execution flows that could lead to the use of a null pointer. For example, they'll tell you that if the following 6 branches are taken, you could end up using an invalid pointer. In some cases, they even detect it across a chain of function calls. Perhaps you don't call this static analysis, because it actually analyzes execution flows, but both of these are classified as static analysis tools. Some warnings can be false positives for reasons that the tool can't understand, but they're worth investigating.

                                        Robust Services Core | Software Techniques for Lemmings | Articles
                                        The fox knows many things, but the hedgehog knows one big thing.

                                        J Offline
                                        J Offline
                                        jschell
                                        wrote on last edited by
                                        #28

                                        Greg Utas wrote:

                                        Perhaps you don't call this static analysis,

                                        I do.

                                        Greg Utas wrote:

                                        they even detect it across a chain of function calls

                                        That I have not seen. Unclear if the tool did not look of if they did not exist.

                                        1 Reply Last reply
                                        0
                                        • M Mircea Neacsu

                                          Trust me, it's much worse when you go through your own's and go: "What was I thinking!" :laugh:

                                          Mircea

                                          M Offline
                                          M Offline
                                          Member 16171156
                                          wrote on last edited by
                                          #29

                                          Things get complicated when we are not able to understand them clearly. The other possible reason can be Overthinking, which exaggerates a simple situation and makes it appear worse. A person ends up imagining certain situations which in reality won't happen.

                                          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