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. #if NOT_USED

#if NOT_USED

Scheduled Pinned Locked Moved The Weird and The Wonderful
help
14 Posts 7 Posters 1 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.
  • P pbraun

    In my recent quests to solve an issue with legacy code, I found several places where code blocks are wrapped in #if NOT_USED ... #endif This is confusing to me since if NOT_USED is defined, then the code will be compiled into the project.

    Phil

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

    Sounds like someone's not using version control on the source, or if they are, they are afraid of using the delete key to actually remove the code. I find this to be the least confusing way of ensuring that code is not compiled into a project. :)

    Chris Meech I am Canadian. [heard in a local bar]

    P P 2 Replies Last reply
    0
    • C Chris Meech

      Sounds like someone's not using version control on the source, or if they are, they are afraid of using the delete key to actually remove the code. I find this to be the least confusing way of ensuring that code is not compiled into a project. :)

      Chris Meech I am Canadian. [heard in a local bar]

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #4

      Don't get technical with your new fangled ways. I'm just surprised he didn't use a hex editor on the compiled code.

      Deja View - the feeling that you've seen this post before.

      1 Reply Last reply
      0
      • C Chris Meech

        Sounds like someone's not using version control on the source, or if they are, they are afraid of using the delete key to actually remove the code. I find this to be the least confusing way of ensuring that code is not compiled into a project. :)

        Chris Meech I am Canadian. [heard in a local bar]

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

        I think the point is that NOT_USED could be defined at some point, and hose things up.

        C P J 3 Replies Last reply
        0
        • P PIEBALDconsult

          I think the point is that NOT_USED could be defined at some point, and hose things up.

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

          You're correct and I understood that point. But, I see that my response could be mis-interpreted from that. For me, if I want to ensure that code is not compiled, I prefer to use the delete key and depend upon source control to preserve the code. :)

          Chris Meech I am Canadian. [heard in a local bar]

          P P 2 Replies Last reply
          0
          • C Chris Meech

            You're correct and I understood that point. But, I see that my response could be mis-interpreted from that. For me, if I want to ensure that code is not compiled, I prefer to use the delete key and depend upon source control to preserve the code. :)

            Chris Meech I am Canadian. [heard in a local bar]

            P Offline
            P Offline
            Pete OHanlon
            wrote on last edited by
            #7

            Chris Meech wrote:

            depend upon source control to preserve the code

            Well, as long as it's not VSS.

            Deja View - the feeling that you've seen this post before.

            1 Reply Last reply
            0
            • C Chris Meech

              You're correct and I understood that point. But, I see that my response could be mis-interpreted from that. For me, if I want to ensure that code is not compiled, I prefer to use the delete key and depend upon source control to preserve the code. :)

              Chris Meech I am Canadian. [heard in a local bar]

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

              Yes, delete is good for the soul.

              1 Reply Last reply
              0
              • P PIEBALDconsult

                I think the point is that NOT_USED could be defined at some point, and hose things up.

                P Offline
                P Offline
                pbraun
                wrote on last edited by
                #9

                Actually the point is that there are many other ways to exclude code from being compiled, but using #ifdef NOT_USED creates confusion as to the intentions of the original developer. I prefer to be perfectly clear if I don't want the code compiled and either comment it out (with an explanation) or delete it entirely.

                Phil

                J 1 Reply Last reply
                0
                • P pbraun

                  In my recent quests to solve an issue with legacy code, I found several places where code blocks are wrapped in #if NOT_USED ... #endif This is confusing to me since if NOT_USED is defined, then the code will be compiled into the project.

                  Phil

                  R Offline
                  R Offline
                  Russell
                  wrote on last edited by
                  #10

                  One year ago:

                  BOOL IsFalse;
                  ...
                  IsFalse=FALSE;
                  ...
                  if(IsFalse){
                  ...
                  }

                  :omg::wtf::eek::wtf::omg: :((:((


                  Russell

                  L 1 Reply Last reply
                  0
                  • R Russell

                    One year ago:

                    BOOL IsFalse;
                    ...
                    IsFalse=FALSE;
                    ...
                    if(IsFalse){
                    ...
                    }

                    :omg::wtf::eek::wtf::omg: :((:((


                    Russell

                    L Offline
                    L Offline
                    Lutoslaw
                    wrote on last edited by
                    #11

                    The programmer who wrote it must suffered from depression... I would rather use IsTrue - it's definately more optimistic, isn't it?

                    Greetings - Gajatko Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.

                    R 1 Reply Last reply
                    0
                    • L Lutoslaw

                      The programmer who wrote it must suffered from depression... I would rather use IsTrue - it's definately more optimistic, isn't it?

                      Greetings - Gajatko Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.

                      R Offline
                      R Offline
                      Russell
                      wrote on last edited by
                      #12

                      gajatko wrote:

                      t's definately more optimistic

                      for sure!:laugh::laugh: I simply modifyed the variable name to

                      BOOL Flag;

                      :~ there wasn't absolutly any reason to give it a name:-O


                      Russell

                      1 Reply Last reply
                      0
                      • P PIEBALDconsult

                        I think the point is that NOT_USED could be defined at some point, and hose things up.

                        J Offline
                        J Offline
                        jibalt
                        wrote on last edited by
                        #13

                        There are lots of moronic things people can do to hose things up ... defining NOT_USED is just one of them. It could be called DONT_DEFINE_THIS_BECAUSE_IT_EXCLUDES_CODE_THAT_SHOULD_NOT_BE_COMPILED and one could just as well define that.

                        1 Reply Last reply
                        0
                        • P pbraun

                          Actually the point is that there are many other ways to exclude code from being compiled, but using #ifdef NOT_USED creates confusion as to the intentions of the original developer. I prefer to be perfectly clear if I don't want the code compiled and either comment it out (with an explanation) or delete it entirely.

                          Phil

                          J Offline
                          J Offline
                          jibalt
                          wrote on last edited by
                          #14

                          It only confuses stupid people.

                          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