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 2 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
    Maximilien
    wrote on last edited by
    #1

    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

    M M M S E 9 Replies 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

      M Offline
      M Offline
      Mircea Neacsu
      wrote on last edited by
      #2

      I use my prescient powers to see that you are going through someone else's code base. :laugh:

      Mircea

      M 1 Reply Last reply
      0
      • M Mircea Neacsu

        I use my prescient powers to see that you are going through someone else's code base. :laugh:

        Mircea

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

        yeah! :sigh:

        CI/CD = Continuous Impediment/Continuous Despair

        M 1 Reply Last reply
        0
        • M Maximilien

          yeah! :sigh:

          CI/CD = Continuous Impediment/Continuous Despair

          M Offline
          M Offline
          Mircea Neacsu
          wrote on last edited by
          #4

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

          Mircea

          A M 2 Replies 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

            M Offline
            M Offline
            MarkTJohnson
            wrote on last edited by
            #5

            Well, sometimes you are comparing strings and other times you are comparing characters.

            I’ve given up trying to be calm. However, I am open to feeling slightly less agitated. I’m begging you for the benefit of everyone, don’t be STUPID.

            M P 2 Replies Last reply
            0
            • M MarkTJohnson

              Well, sometimes you are comparing strings and other times you are comparing characters.

              I’ve given up trying to be calm. However, I am open to feeling slightly less agitated. I’m begging you for the benefit of everyone, don’t be STUPID.

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

              if only ... both defines are used at max a dozen of times in places where performance is not required.

              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

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

                Job security? Or maybe someone was paid by lines of code? The ‘why’ is almost always inscrutable, but likely the coder slept between sessions. Cleaning someone else’s code is both satisfying and nerve wracking. Good luck. :)

                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 MarkTJohnson

                  Well, sometimes you are comparing strings and other times you are comparing characters.

                  I’ve given up trying to be calm. However, I am open to feeling slightly less agitated. I’m begging you for the benefit of everyone, don’t be STUPID.

                  P Offline
                  P Offline
                  Paul Sanders the other one
                  wrote on last edited by
                  #8

                  szSTATUS_DONE [0]?

                  Paul Sanders. If I had more time, I would have written a shorter letter - Blaise Pascal. Some of my best work is in the undo buffer.

                  1 Reply Last reply
                  0
                  • M Mark Starr

                    Job security? Or maybe someone was paid by lines of code? The ‘why’ is almost always inscrutable, but likely the coder slept between sessions. Cleaning someone else’s code is both satisfying and nerve wracking. Good luck. :)

                    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
                    #9

                    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 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

                      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
                                          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