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. The Lounge
  3. Department of Redundancy Department

Department of Redundancy Department

Scheduled Pinned Locked Moved The Lounge
c++question
27 Posts 16 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.
  • Richard DeemingR Richard Deeming

    Was blnVariable ever nullable? But then, even if it was, you could have just used:

    setVal(CODE, blnVariable == true);


    "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

    D Offline
    D Offline
    den2k88
    wrote on last edited by
    #6

    It's not, and I know precisely what I could have used :D I was probably just tired or distracted by my many other tasks.

    GCS d-- s-/++ a- C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- ++>+++ y+++*      Weapons extension: ma- k++ F+2 X

    F P 2 Replies Last reply
    0
    • D den2k88

      AKA I found out that yeasterday I wrote a code like this

      if (blnVariable == true) {
      setVal(CODE, true);
      } else {
      setVal(CODE, false);
      }

      Luckily I got it before someone could shame me forever about it (including myself).

      GCS d-- s-/++ a- C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- ++>+++ y+++*      Weapons extension: ma- k++ F+2 X

      R Offline
      R Offline
      raddevus
      wrote on last edited by
      #7

      spoiler below... :-D Right? Right? :-\ I'm trying out for the Department of the Obvious -- I'm hoping to be a Captain! :laugh:

      setVal(CODE, blnVariable);

      D 1 Reply Last reply
      0
      • R raddevus

        spoiler below... :-D Right? Right? :-\ I'm trying out for the Department of the Obvious -- I'm hoping to be a Captain! :laugh:

        setVal(CODE, blnVariable);

        D Offline
        D Offline
        den2k88
        wrote on last edited by
        #8

        Yep, you are now promoted to Admiral Obvious :D

        GCS d-- s-/++ a- C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- ++>+++ y+++*      Weapons extension: ma- k++ F+2 X

        R 1 Reply Last reply
        0
        • D den2k88

          Yep, you are now promoted to Admiral Obvious :D

          GCS d-- s-/++ a- C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- ++>+++ y+++*      Weapons extension: ma- k++ F+2 X

          R Offline
          R Offline
          raddevus
          wrote on last edited by
          #9

          I knew with hard work, gratuitous flattery and a monetary bribe I would eventually get the promotion. :laugh: ahem...I believe your forgot to upvote me. I may be forced to report you to the moderator. :rolleyes:

          D 1 Reply Last reply
          0
          • D den2k88

            AKA I found out that yeasterday I wrote a code like this

            if (blnVariable == true) {
            setVal(CODE, true);
            } else {
            setVal(CODE, false);
            }

            Luckily I got it before someone could shame me forever about it (including myself).

            GCS d-- s-/++ a- C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- ++>+++ y+++*      Weapons extension: ma- k++ F+2 X

            CPalliniC Offline
            CPalliniC Offline
            CPallini
            wrote on last edited by
            #10

            Oh the gold old days of software paid per LOC. :-D

            In testa che avete, signor di Ceprano?

            D 1 Reply Last reply
            0
            • D den2k88

              It's not, and I know precisely what I could have used :D I was probably just tired or distracted by my many other tasks.

              GCS d-- s-/++ a- C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- ++>+++ y+++*      Weapons extension: ma- k++ F+2 X

              F Offline
              F Offline
              Foothill
              wrote on last edited by
              #11

              Looks like you might have typed it exactly how you thought it...if this variable over here is true than this other variable has to set to true too.

              if (Object.DividedByZero == true) { Universe.Implode(); } Meus ratio ex fortis machina. Simplicitatis de formae ac munus. -Foothill, 2016

              1 Reply Last reply
              0
              • D den2k88

                AKA I found out that yeasterday I wrote a code like this

                if (blnVariable == true) {
                setVal(CODE, true);
                } else {
                setVal(CODE, false);
                }

                Luckily I got it before someone could shame me forever about it (including myself).

                GCS d-- s-/++ a- C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- ++>+++ y+++*      Weapons extension: ma- k++ F+2 X

                C Offline
                C Offline
                Chris Maunder
                wrote on last edited by
                #12

                Someone get this man a beer.

                cheers Chris Maunder

                D 1 Reply Last reply
                0
                • R raddevus

                  I knew with hard work, gratuitous flattery and a monetary bribe I would eventually get the promotion. :laugh: ahem...I believe your forgot to upvote me. I may be forced to report you to the moderator. :rolleyes:

                  D Offline
                  D Offline
                  den2k88
                  wrote on last edited by
                  #13

                  Using CP from smartphone is painful :D mainly because I write too much and I definetely can't write anything from a teeny tiny phone.

                  GCS d-- s-/++ a- C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- ++>+++ y+++*      Weapons extension: ma- k++ F+2 X

                  R 1 Reply Last reply
                  0
                  • CPalliniC CPallini

                    Oh the gold old days of software paid per LOC. :-D

                    D Offline
                    D Offline
                    den2k88
                    wrote on last edited by
                    #14

                    CPallini wrote:

                    Oh the gold old days of software paid for

                    FTFY

                    GCS d-- s-/++ a- C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- ++>+++ y+++*      Weapons extension: ma- k++ F+2 X

                    1 Reply Last reply
                    0
                    • D den2k88

                      Using CP from smartphone is painful :D mainly because I write too much and I definetely can't write anything from a teeny tiny phone.

                      GCS d-- s-/++ a- C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- ++>+++ y+++*      Weapons extension: ma- k++ F+2 X

                      R Offline
                      R Offline
                      raddevus
                      wrote on last edited by
                      #15

                      I will allow an exception this one time since you had a good excuse. :laugh:

                      1 Reply Last reply
                      0
                      • D den2k88

                        AKA I found out that yeasterday I wrote a code like this

                        if (blnVariable == true) {
                        setVal(CODE, true);
                        } else {
                        setVal(CODE, false);
                        }

                        Luckily I got it before someone could shame me forever about it (including myself).

                        GCS d-- s-/++ a- C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- ++>+++ y+++*      Weapons extension: ma- k++ F+2 X

                        D Offline
                        D Offline
                        David ONeil
                        wrote on last edited by
                        #16

                        Yeah, they are far better like this: if (blnVariable = true) { setVal(CODE, true); } else { setVal(CODE, false); }

                        The forgotten roots of science | C++ Programming | DWinLib

                        1 Reply Last reply
                        0
                        • D den2k88

                          AKA I found out that yeasterday I wrote a code like this

                          if (blnVariable == true) {
                          setVal(CODE, true);
                          } else {
                          setVal(CODE, false);
                          }

                          Luckily I got it before someone could shame me forever about it (including myself).

                          GCS d-- s-/++ a- C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- ++>+++ y+++*      Weapons extension: ma- k++ F+2 X

                          M Offline
                          M Offline
                          megaadam
                          wrote on last edited by
                          #17

                          That code looks like a pretty decent hangover!

                          ... such stuff as dreams are made on

                          1 Reply Last reply
                          0
                          • D den2k88

                            AKA I found out that yeasterday I wrote a code like this

                            if (blnVariable == true) {
                            setVal(CODE, true);
                            } else {
                            setVal(CODE, false);
                            }

                            Luckily I got it before someone could shame me forever about it (including myself).

                            GCS d-- s-/++ a- C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- ++>+++ y+++*      Weapons extension: ma- k++ F+2 X

                            D Offline
                            D Offline
                            Dan Neely
                            wrote on last edited by
                            #18

                            If you've replaced that with:

                            setVal(CODE, bInVariable);

                            you've introduced a bug whenever `bInVariable` is equal to `FileNotFound`.

                            Did you ever see history portrayed as an old man with a wise brow and pulseless heart, weighing all things in the balance of reason? Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful? --Zachris Topelius Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies. -- Sarah Hoyt

                            D 1 Reply Last reply
                            0
                            • D Dan Neely

                              If you've replaced that with:

                              setVal(CODE, bInVariable);

                              you've introduced a bug whenever `bInVariable` is equal to `FileNotFound`.

                              Did you ever see history portrayed as an old man with a wise brow and pulseless heart, weighing all things in the balance of reason? Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful? --Zachris Topelius Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies. -- Sarah Hoyt

                              D Offline
                              D Offline
                              den2k88
                              wrote on last edited by
                              #19

                              Impossible as it is VisualBasic (I put it in C only to not hurt anyone sensibility) and not .NET (yes, tried and true VB6, that's what I have to work with) so it is a Boolean that can be only True or False and it is initialized to False. If there was such a possibility I would have kept the code as it was, of course.

                              GCS d-- s-/++ a- C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- ++>+++ y+++*      Weapons extension: ma- k++ F+2 X

                              D 1 Reply Last reply
                              0
                              • D den2k88

                                AKA I found out that yeasterday I wrote a code like this

                                if (blnVariable == true) {
                                setVal(CODE, true);
                                } else {
                                setVal(CODE, false);
                                }

                                Luckily I got it before someone could shame me forever about it (including myself).

                                GCS d-- s-/++ a- C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- ++>+++ y+++*      Weapons extension: ma- k++ F+2 X

                                O Offline
                                O Offline
                                obermd
                                wrote on last edited by
                                #20

                                Could you actually have written something else and realized you had "identical" code in both clauses of the if statement, leading to the obvious replacement with your function calls. You just hadn't made the next step yet.

                                1 Reply Last reply
                                0
                                • D den2k88

                                  Impossible as it is VisualBasic (I put it in C only to not hurt anyone sensibility) and not .NET (yes, tried and true VB6, that's what I have to work with) so it is a Boolean that can be only True or False and it is initialized to False. If there was such a possibility I would have kept the code as it was, of course.

                                  GCS d-- s-/++ a- C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- ++>+++ y+++*      Weapons extension: ma- k++ F+2 X

                                  D Offline
                                  D Offline
                                  Dan Neely
                                  wrote on last edited by
                                  #21

                                  That goes to show that you just can't win; and not just because you're working in VB6. :doh:

                                  Did you ever see history portrayed as an old man with a wise brow and pulseless heart, weighing all things in the balance of reason? Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful? --Zachris Topelius Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies. -- Sarah Hoyt

                                  1 Reply Last reply
                                  0
                                  • C Chris Maunder

                                    Someone get this man a beer.

                                    cheers Chris Maunder

                                    D Offline
                                    D Offline
                                    Dan Neely
                                    wrote on last edited by
                                    #22

                                    "Beer, the cause of and solution to all of life's problems."

                                    Did you ever see history portrayed as an old man with a wise brow and pulseless heart, weighing all things in the balance of reason? Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful? --Zachris Topelius Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies. -- Sarah Hoyt

                                    1 Reply Last reply
                                    0
                                    • D den2k88

                                      It's not, and I know precisely what I could have used :D I was probably just tired or distracted by my many other tasks.

                                      GCS d-- s-/++ a- C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- ++>+++ y+++*      Weapons extension: ma- k++ F+2 X

                                      P Offline
                                      P Offline
                                      Paulo_JCG
                                      wrote on last edited by
                                      #23

                                      - Or you had more code inside the if... - Or you extract the Method...

                                      Paulo Gomes Measuring programming progress by lines of code is like measuring aircraft building progress by weight. —Bill Gates Everything should be made as simple as possible, but not simpler. —Albert Einstein

                                      1 Reply Last reply
                                      0
                                      • D den2k88

                                        AKA I found out that yeasterday I wrote a code like this

                                        if (blnVariable == true) {
                                        setVal(CODE, true);
                                        } else {
                                        setVal(CODE, false);
                                        }

                                        Luckily I got it before someone could shame me forever about it (including myself).

                                        GCS d-- s-/++ a- C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- ++>+++ y+++*      Weapons extension: ma- k++ F+2 X

                                        A Offline
                                        A Offline
                                        Andy Malcolm 2
                                        wrote on last edited by
                                        #24

                                        I found this bit of code a few days ago:- :confused: __builtin_write_OSCCONL((uint8) (0x0200 & 0x00FF));

                                        A 1 Reply Last reply
                                        0
                                        • A Andy Malcolm 2

                                          I found this bit of code a few days ago:- :confused: __builtin_write_OSCCONL((uint8) (0x0200 & 0x00FF));

                                          A Offline
                                          A Offline
                                          ajhampson
                                          wrote on last edited by
                                          #25

                                          That is just awesome on so many levels!

                                          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