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. Does C++ long for VB?

Does C++ long for VB?

Scheduled Pinned Locked Moved The Weird and The Wonderful
c++delphiquestion
11 Posts 8 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.
  • T Offline
    T Offline
    Tsuda Kageyu
    wrote on last edited by
    #1

    Or maybe Pascal.

    class A
    {
    private:
    // A lot of members.
    public:
    bool operator==(const A &rhs) const { return (this == &rhs); }

    bool operator=(const A &rhs) const 
    {
        // Compares the members.
    }
    
    bool operator!=(const A &rhs) const { return (!operator=(rhs)); }
    

    };

    M L S M R 5 Replies Last reply
    0
    • T Tsuda Kageyu

      Or maybe Pascal.

      class A
      {
      private:
      // A lot of members.
      public:
      bool operator==(const A &rhs) const { return (this == &rhs); }

      bool operator=(const A &rhs) const 
      {
          // Compares the members.
      }
      
      bool operator!=(const A &rhs) const { return (!operator=(rhs)); }
      

      };

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

      Awesome! Just what I need to make my code work.

      ..................... Life is too shor

      1 Reply Last reply
      0
      • T Tsuda Kageyu

        Or maybe Pascal.

        class A
        {
        private:
        // A lot of members.
        public:
        bool operator==(const A &rhs) const { return (this == &rhs); }

        bool operator=(const A &rhs) const 
        {
            // Compares the members.
        }
        
        bool operator!=(const A &rhs) const { return (!operator=(rhs)); }
        

        };

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

        Seriously, this should be outlawed. Why use redefine the == operator to compare the addresses, not the values, of the operands? Why redefine the assignment operator to perform a comparison? C++ might be thought to be a horrible language by some (sometimes including me), but why make it even worse by redefining operators to have inconsistent semantics? I truly desire that the author of that code die a horrible death.

        Eduardo León

        T P 2 Replies Last reply
        0
        • L leonej_dt

          Seriously, this should be outlawed. Why use redefine the == operator to compare the addresses, not the values, of the operands? Why redefine the assignment operator to perform a comparison? C++ might be thought to be a horrible language by some (sometimes including me), but why make it even worse by redefining operators to have inconsistent semantics? I truly desire that the author of that code die a horrible death.

          Eduardo León

          T Offline
          T Offline
          Tsuda Kageyu
          wrote on last edited by
          #4

          Right. It's a kind of booby trap. But I was surprised rather than being angry when I found it.

          1 Reply Last reply
          0
          • T Tsuda Kageyu

            Or maybe Pascal.

            class A
            {
            private:
            // A lot of members.
            public:
            bool operator==(const A &rhs) const { return (this == &rhs); }

            bool operator=(const A &rhs) const 
            {
                // Compares the members.
            }
            
            bool operator!=(const A &rhs) const { return (!operator=(rhs)); }
            

            };

            S Offline
            S Offline
            stephen hazel
            wrote on last edited by
            #5

            no. it doesn't.

            S 1 Reply Last reply
            0
            • S stephen hazel

              no. it doesn't.

              S Offline
              S Offline
              Sterling Camden independent consultant
              wrote on last edited by
              #6

              The language doesn't, but maybe the author of this crapware does. What he should get instead is death by redefining his extremities as hamburger.

              Contains coding, but not narcotic.

              1 Reply Last reply
              0
              • T Tsuda Kageyu

                Or maybe Pascal.

                class A
                {
                private:
                // A lot of members.
                public:
                bool operator==(const A &rhs) const { return (this == &rhs); }

                bool operator=(const A &rhs) const 
                {
                    // Compares the members.
                }
                
                bool operator!=(const A &rhs) const { return (!operator=(rhs)); }
                

                };

                M Offline
                M Offline
                M Towler
                wrote on last edited by
                #7

                Proof of the old adage that you can write rubbish in any language. Just because you used a hammer to remove your own teeth, does not imply hammers are faulty.

                1 Reply Last reply
                0
                • L leonej_dt

                  Seriously, this should be outlawed. Why use redefine the == operator to compare the addresses, not the values, of the operands? Why redefine the assignment operator to perform a comparison? C++ might be thought to be a horrible language by some (sometimes including me), but why make it even worse by redefining operators to have inconsistent semantics? I truly desire that the author of that code die a horrible death.

                  Eduardo León

                  P Offline
                  P Offline
                  pg az
                  wrote on last edited by
                  #8

                  How embarrassing, I did not immediately notice the issue with "redefining ==" - you are rewarded with a free book tip, Jeff Johnson's latest "Designing with the Mind in Mind", might be alternately titled "Don't even TRY to make me think". This is a brief very-well-edited book, if you haven't got a lot of time the book-price for this slim volume is OK because you learn a lot in few pages, there's no "padding".
                  Also on the same topic, somewhere in Gary Kasparov's "How Life Imitates Chess", he describes how he carefully designed his first try at a chess website, because after all who could be expected to think more than world-class-chess-player-wannabe's. But the usability cameras captured these folks just instinctively clicking without a conscious thought, the way we all do, sigh.

                  pg--az

                  L 1 Reply Last reply
                  0
                  • P pg az

                    How embarrassing, I did not immediately notice the issue with "redefining ==" - you are rewarded with a free book tip, Jeff Johnson's latest "Designing with the Mind in Mind", might be alternately titled "Don't even TRY to make me think". This is a brief very-well-edited book, if you haven't got a lot of time the book-price for this slim volume is OK because you learn a lot in few pages, there's no "padding".
                    Also on the same topic, somewhere in Gary Kasparov's "How Life Imitates Chess", he describes how he carefully designed his first try at a chess website, because after all who could be expected to think more than world-class-chess-player-wannabe's. But the usability cameras captured these folks just instinctively clicking without a conscious thought, the way we all do, sigh.

                    pg--az

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

                    pg--az wrote:

                    How embarrassing, I did not immediately notice the issue with "redefining ==" - you are rewarded with a free book tip, Jeff Johnson's latest "Designing with the Mind in Mind", might be alternately titled "Don't even TRY to make me think". This is a brief very-well-edited book, if you haven't got a lot of time the book-price for this slim volume is OK because you learn a lot in few pages, there's no "padding".

                    Thanks. I am good at designing consumable classes/services/subsystems/frameworks that do not make programmers think more than they are supposed to, and sometimes make them think less. Perhaps because I am a fellow programmer, and I especially like systems programming. On the other hand, I am terrible at designing user interfaces that do not make users think more. Designing user interfaces is more of an art than a technical discipline, especially if your users are not engineers, accountants or finance guys.

                    pg--az wrote:

                    Also on the same topic, somewhere in Gary Kasparov's "How Life Imitates Chess", he describes how he carefully designed his first try at a chess website, because after all who could be expected to think more than world-class-chess-player-wannabe's. But the usability cameras captured these folks just instinctively clicking without a conscious thought, the way we all do, sigh.

                    Help: First read without the parentheses. Then use the information in parentheses to add context/extra information/gratuitous pedantry. Well, after having spent my whole childhood and adolescence believing I was inherently superior because I could do math and science (this is what gives you license to be pedant in first place, but, wait, there is more), learn languages with ease (by tackling grammar and syntax first, and only then vocabulary, unlike most people), play chess (I was second board of my first school's team (not because the guy on first board was stronger, but because he was more calm than I, and could handle losses better) and first board of my second school's team), understand music theory (which is nothing more than "applied" (for non-real world definitions of "applied") integer arithmetic modulo 12), tell a musical note right after I listened to it (aka absolute pitch, which I could have applied in real life to impress chicks by playing their favorite songs, but I had my own set of favorite songs, mainly Dream Theater "songs" back then, and I was like "I do not p

                    P 1 Reply Last reply
                    0
                    • L leonej_dt

                      pg--az wrote:

                      How embarrassing, I did not immediately notice the issue with "redefining ==" - you are rewarded with a free book tip, Jeff Johnson's latest "Designing with the Mind in Mind", might be alternately titled "Don't even TRY to make me think". This is a brief very-well-edited book, if you haven't got a lot of time the book-price for this slim volume is OK because you learn a lot in few pages, there's no "padding".

                      Thanks. I am good at designing consumable classes/services/subsystems/frameworks that do not make programmers think more than they are supposed to, and sometimes make them think less. Perhaps because I am a fellow programmer, and I especially like systems programming. On the other hand, I am terrible at designing user interfaces that do not make users think more. Designing user interfaces is more of an art than a technical discipline, especially if your users are not engineers, accountants or finance guys.

                      pg--az wrote:

                      Also on the same topic, somewhere in Gary Kasparov's "How Life Imitates Chess", he describes how he carefully designed his first try at a chess website, because after all who could be expected to think more than world-class-chess-player-wannabe's. But the usability cameras captured these folks just instinctively clicking without a conscious thought, the way we all do, sigh.

                      Help: First read without the parentheses. Then use the information in parentheses to add context/extra information/gratuitous pedantry. Well, after having spent my whole childhood and adolescence believing I was inherently superior because I could do math and science (this is what gives you license to be pedant in first place, but, wait, there is more), learn languages with ease (by tackling grammar and syntax first, and only then vocabulary, unlike most people), play chess (I was second board of my first school's team (not because the guy on first board was stronger, but because he was more calm than I, and could handle losses better) and first board of my second school's team), understand music theory (which is nothing more than "applied" (for non-real world definitions of "applied") integer arithmetic modulo 12), tell a musical note right after I listened to it (aka absolute pitch, which I could have applied in real life to impress chicks by playing their favorite songs, but I had my own set of favorite songs, mainly Dream Theater "songs" back then, and I was like "I do not p

                      P Offline
                      P Offline
                      pg az
                      wrote on last edited by
                      #10

                      leonej_dt wrote:

                      e believing I was inherently superior because I could do math and science

                      Yes, me too. But what might count even more is the "Visio-spatial tasks", like say picking up a pail of water with a "Cat 432 Backhoe-Loader". If you go to youtube and search for (( BBC Secret of the Sexes (part 2) )), you get the thumbnail of the woman in the cab with the yellow-hard-hat. This is a FASCINATING video, probably motivating you to go back and get the context from part 1, parts 3 and 4 are also great.

                      leonej_dt wrote:

                      learn languages with ease

                      You're one-up on me there, but again if you goto youtube and search for (( tammet icelandic language )), the fourth hit mentions that Daniel Tammet learned icelandic in a week, to a sufficient conversational standard to pass muster on a TV Talk Show ! I forget exactly which of the videos shows snippets from his week-of-learning, and then the final TV appearance, but this is amazing. It motivated me to read his book "Embracing the Wide Sky" which contains great insight into how being multilingual really DOES have "spin-off" benefits in other areas, especially of course if you got thay way as a toddler.
                      Probably you should not dare to reply, these are the top tidbits on my personal armchair quest to get a meta-model of my own mind, but most likely we could continue WAY off-topic on this.

                      pg--az

                      1 Reply Last reply
                      0
                      • T Tsuda Kageyu

                        Or maybe Pascal.

                        class A
                        {
                        private:
                        // A lot of members.
                        public:
                        bool operator==(const A &rhs) const { return (this == &rhs); }

                        bool operator=(const A &rhs) const 
                        {
                            // Compares the members.
                        }
                        
                        bool operator!=(const A &rhs) const { return (!operator=(rhs)); }
                        

                        };

                        R Offline
                        R Offline
                        richard_k
                        wrote on last edited by
                        #11

                        A new low in obfuscation. Why use just the comparison operators when you can involve the rest in the task!! I'm curious what this person was thinking in doing this? Of course, there is the attendant fear of discovering what they were thinking.. I retract my question.

                        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