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. Once more unto the C++, dear friends, once more

Once more unto the C++, dear friends, once more

Scheduled Pinned Locked Moved The Lounge
questionc++csscom
35 Posts 18 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.
  • D Dan Neely

    ^ is XOR in C++, vs exponentiation in arithmetic. It's retarded.

    The latest nation. Procrastination.

    J Offline
    J Offline
    John M Drescher
    wrote on last edited by
    #12

    Dan Neely wrote:

    It's retarded.

    Agreed. Although, in the 600K to 800K lines of C++ I have produced I do not recall ever using that one time. I would have had to look it up if I saw it..

    John

    D S 2 Replies Last reply
    0
    • P pelnor

      I have not written any C++ code since 2001. Now I'm dragging one of my old dll's out of mothballs to add some new features. Some where in those 8 absent years the garbage collector or my brain declared C++ syntax of no use and deleted it for me. Now I'm staring at my code wondering what all the hieroglyphics are for. Let's see there's this * guy. He's got something to do with pointers. It's attached or next to some of my variables. Then there's ::, <<, >>, wait.... wait, it's coming back to me.... "<<" is super less than. Got it moving on. Then I run into ^. Oh come on! Who thought ^ was a good idea? Linker? what is that? You mean I have to tell this linker of yours where to look for things just so I can compile? There isn't just a magic "make it go button"? This is going to be a long day. Better load up on the caffeine.

      Latest toy built for fun: Web Lens Best feature: Full size images when using Google image search.

      S Offline
      S Offline
      Single Step Debugger
      wrote on last edited by
      #13

      And if you put “&” before some variable, it will returns a strange combination of letters and numbers. I usually use this cute property for getting random numbers in runtime – works great!

      The narrow specialist in the broad sense of the word is a complete idiot in the narrow sense of the word. Advertise here – minimum three posts per day are guaranteed.

      1 Reply Last reply
      0
      • N Nemanja Trifunovic

        Rama Krishna Vavilala wrote:

        Which was even worse

        I dissagree. Underscores are a standard-sanctioned way to extend the language. There was really no reason to break compatibility with Managed C++ and introduce "C++/CLI".

        utf8-cpp

        R Offline
        R Offline
        Rama Krishna Vavilala
        wrote on last edited by
        #14

        Nemanja Trifunovic wrote:

        Underscores are a standard-sanctioned way to extend the language

        I agree with that. But there was no need for that (_gc keyword) in the first place. The whole thing could have been a lot simpler. The code simply looked ugly.

        Nemanja Trifunovic wrote:

        There was really no reason to break compatibility with Managed C++ and introduce "C++/CLI".

        Managed C++ was ugly so was C++/CLI. So no arguments there.

        N 1 Reply Last reply
        0
        • P pelnor

          I have not written any C++ code since 2001. Now I'm dragging one of my old dll's out of mothballs to add some new features. Some where in those 8 absent years the garbage collector or my brain declared C++ syntax of no use and deleted it for me. Now I'm staring at my code wondering what all the hieroglyphics are for. Let's see there's this * guy. He's got something to do with pointers. It's attached or next to some of my variables. Then there's ::, <<, >>, wait.... wait, it's coming back to me.... "<<" is super less than. Got it moving on. Then I run into ^. Oh come on! Who thought ^ was a good idea? Linker? what is that? You mean I have to tell this linker of yours where to look for things just so I can compile? There isn't just a magic "make it go button"? This is going to be a long day. Better load up on the caffeine.

          Latest toy built for fun: Web Lens Best feature: Full size images when using Google image search.

          D Offline
          D Offline
          Dave Parker
          wrote on last edited by
          #15

          It's even better now. As well as pointers and references you now have handles. :) Not that I've ever worked with managed C++ or whatever its called now but I bet it's fun trying to get a handle on pointers to references of pointers to handles. Thing*&^thingy=&somethingNasty; (A while since I did C++ so the above is probably wrong.....)

          1 Reply Last reply
          0
          • P pelnor

            I have not written any C++ code since 2001. Now I'm dragging one of my old dll's out of mothballs to add some new features. Some where in those 8 absent years the garbage collector or my brain declared C++ syntax of no use and deleted it for me. Now I'm staring at my code wondering what all the hieroglyphics are for. Let's see there's this * guy. He's got something to do with pointers. It's attached or next to some of my variables. Then there's ::, <<, >>, wait.... wait, it's coming back to me.... "<<" is super less than. Got it moving on. Then I run into ^. Oh come on! Who thought ^ was a good idea? Linker? what is that? You mean I have to tell this linker of yours where to look for things just so I can compile? There isn't just a magic "make it go button"? This is going to be a long day. Better load up on the caffeine.

            Latest toy built for fun: Web Lens Best feature: Full size images when using Google image search.

            R Offline
            R Offline
            RugbyLeague
            wrote on last edited by
            #16

            I am converting a compiler and language runtime written in C++ into C# - that's fun :^)

            J J 2 Replies Last reply
            0
            • E Electron Shepherd

              pelnor wrote:

              There isn't just a magic "make it go button"?

              F5 and a properly configured workspace?

              Server and Network Monitoring

              P Offline
              P Offline
              pelnor
              wrote on last edited by
              #17

              Propery configured was the challenge. I way jumping the old project over several versions of VS. Things did not go as smooth as i hoped for. But with google by my side i can't fail.

              Latest toy built for fun: Web Lens Best feature: Full size images when using Google image search.

              1 Reply Last reply
              0
              • A Anthony Mushrow

                What have you been working with instead?

                My current favourite word is: Delicious!

                -SK Genius

                Game Programming articles start -here[^]-

                P Offline
                P Offline
                pelnor
                wrote on last edited by
                #18

                Several years of VB got in the way. I mostly do c# now so it's not tooooo much culture shock. Just some head scratching.

                Latest toy built for fun: Web Lens Best feature: Full size images when using Google image search.

                S A 2 Replies Last reply
                0
                • J John M Drescher

                  Dan Neely wrote:

                  It's retarded.

                  Agreed. Although, in the 600K to 800K lines of C++ I have produced I do not recall ever using that one time. I would have had to look it up if I saw it..

                  John

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

                  I know I've used it for something before, although I'm not sure what it was. Toggling a bitflag without knowing it's original value???

                  The latest nation. Procrastination.

                  P 1 Reply Last reply
                  0
                  • R Rama Krishna Vavilala

                    Nemanja Trifunovic wrote:

                    Underscores are a standard-sanctioned way to extend the language

                    I agree with that. But there was no need for that (_gc keyword) in the first place. The whole thing could have been a lot simpler. The code simply looked ugly.

                    Nemanja Trifunovic wrote:

                    There was really no reason to break compatibility with Managed C++ and introduce "C++/CLI".

                    Managed C++ was ugly so was C++/CLI. So no arguments there.

                    N Offline
                    N Offline
                    Nemanja Trifunovic
                    wrote on last edited by
                    #20

                    Rama Krishna Vavilala wrote:

                    ugly

                    I find all C-based languages to be ugly (some more than others). It is not about beauty, but usefulness. Managed C++ is useful for some scenarios and that's what matters. I'd rather use beautiful Haskell but it just does not let me get my job done.

                    utf8-cpp

                    1 Reply Last reply
                    0
                    • D Dan Neely

                      I know I've used it for something before, although I'm not sure what it was. Toggling a bitflag without knowing it's original value???

                      The latest nation. Procrastination.

                      P Offline
                      P Offline
                      Peter Mulholland
                      wrote on last edited by
                      #21

                      what about swapping 2 values without a temp variable:

                      char\* start = str;
                      char\* end = str + (strlen(str) - 1);
                      
                      while (start < end) 
                      {
                          \*start ^= \*end;
                          \*end ^= \*start;
                          \*start++ ^= \*end--;
                      }
                      return str;
                      

                      Pete

                      J 1 Reply Last reply
                      0
                      • P Peter Mulholland

                        what about swapping 2 values without a temp variable:

                        char\* start = str;
                        char\* end = str + (strlen(str) - 1);
                        
                        while (start < end) 
                        {
                            \*start ^= \*end;
                            \*end ^= \*start;
                            \*start++ ^= \*end--;
                        }
                        return str;
                        

                        Pete

                        J Offline
                        J Offline
                        John M Drescher
                        wrote on last edited by
                        #22

                        I remember that you can do this with XORs however for code readability I would never do that in a program.

                        John

                        N 1 Reply Last reply
                        0
                        • J John M Drescher

                          I remember that you can do this with XORs however for code readability I would never do that in a program.

                          John

                          N Offline
                          N Offline
                          Nemanja Trifunovic
                          wrote on last edited by
                          #23

                          John M. Drescher wrote:

                          you can do this with XORs however for code readability I would never do that in a program

                          Meh, pack it into a well named inline function, such as swap_in_place() and the readability problem is solved.

                          utf8-cpp

                          J 1 Reply Last reply
                          0
                          • R RugbyLeague

                            I am converting a compiler and language runtime written in C++ into C# - that's fun :^)

                            J Offline
                            J Offline
                            John M Drescher
                            wrote on last edited by
                            #24

                            I have lots of fun doing the reverse. :laugh:

                            John

                            1 Reply Last reply
                            0
                            • J John M Drescher

                              Dan Neely wrote:

                              It's retarded.

                              Agreed. Although, in the 600K to 800K lines of C++ I have produced I do not recall ever using that one time. I would have had to look it up if I saw it..

                              John

                              S Offline
                              S Offline
                              Single Step Debugger
                              wrote on last edited by
                              #25

                              I’m not agreed. It was all over my code for almost three years. XOR is very heavily used in the cryptography.

                              The narrow specialist in the broad sense of the word is a complete idiot in the narrow sense of the word. Advertise here – minimum three posts per day are guaranteed.

                              J 1 Reply Last reply
                              0
                              • S Single Step Debugger

                                I’m not agreed. It was all over my code for almost three years. XOR is very heavily used in the cryptography.

                                The narrow specialist in the broad sense of the word is a complete idiot in the narrow sense of the word. Advertise here – minimum three posts per day are guaranteed.

                                J Offline
                                J Offline
                                John M Drescher
                                wrote on last edited by
                                #26

                                Deyan Georgiev wrote:

                                XOR is very heavily used in the cryptography.

                                You just reminded me.. I actually may have to dig into this soon to interface with a medical workstation. I will probably just use a standard library however.

                                John

                                1 Reply Last reply
                                0
                                • P pelnor

                                  I have not written any C++ code since 2001. Now I'm dragging one of my old dll's out of mothballs to add some new features. Some where in those 8 absent years the garbage collector or my brain declared C++ syntax of no use and deleted it for me. Now I'm staring at my code wondering what all the hieroglyphics are for. Let's see there's this * guy. He's got something to do with pointers. It's attached or next to some of my variables. Then there's ::, <<, >>, wait.... wait, it's coming back to me.... "<<" is super less than. Got it moving on. Then I run into ^. Oh come on! Who thought ^ was a good idea? Linker? what is that? You mean I have to tell this linker of yours where to look for things just so I can compile? There isn't just a magic "make it go button"? This is going to be a long day. Better load up on the caffeine.

                                  Latest toy built for fun: Web Lens Best feature: Full size images when using Google image search.

                                  J Offline
                                  J Offline
                                  Joe Woodbury
                                  wrote on last edited by
                                  #27

                                  pelnor wrote:

                                  Then I run into ^. Oh come on! Who thought ^ was a good idea?

                                  That's in C# too. And I've used it. (If you're going to harp on symbols, how about & meaning concatenate in VB? Or the difference between \ and /? Of course, just like in C++ and C#, once you know them, you know them.)

                                  T 1 Reply Last reply
                                  0
                                  • R RugbyLeague

                                    I am converting a compiler and language runtime written in C++ into C# - that's fun :^)

                                    J Offline
                                    J Offline
                                    Joe Woodbury
                                    wrote on last edited by
                                    #28

                                    A few weeks ago I moved a chunk of code from C++ to C#. It required very few minor changes, which was so disconcerting that I kept figuring I did something wrong. But it compiled and worked!

                                    1 Reply Last reply
                                    0
                                    • P pelnor

                                      Several years of VB got in the way. I mostly do c# now so it's not tooooo much culture shock. Just some head scratching.

                                      Latest toy built for fun: Web Lens Best feature: Full size images when using Google image search.

                                      S Offline
                                      S Offline
                                      Shog9 0
                                      wrote on last edited by
                                      #29

                                      pelnor wrote:

                                      Several years of VB got in the way

                                      You're lucky all you forgot was C++...

                                      1 Reply Last reply
                                      0
                                      • J Joe Woodbury

                                        pelnor wrote:

                                        Then I run into ^. Oh come on! Who thought ^ was a good idea?

                                        That's in C# too. And I've used it. (If you're going to harp on symbols, how about & meaning concatenate in VB? Or the difference between \ and /? Of course, just like in C++ and C#, once you know them, you know them.)

                                        T Offline
                                        T Offline
                                        thrakazog
                                        wrote on last edited by
                                        #30

                                        Joe Woodbury wrote:

                                        That's in C# too. And I've used it.

                                        The symbol being there is one thing. How it works and what it represents is another. My favorite was always the := in ADA. Wasn't = good enough for them? Some languages can be similar and still miles apart. Or as Homer would say: Le grille? What the hell is that?[^]

                                        D N 2 Replies Last reply
                                        0
                                        • T thrakazog

                                          Joe Woodbury wrote:

                                          That's in C# too. And I've used it.

                                          The symbol being there is one thing. How it works and what it represents is another. My favorite was always the := in ADA. Wasn't = good enough for them? Some languages can be similar and still miles apart. Or as Homer would say: Le grille? What the hell is that?[^]

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

                                          1970 - Niklaus Wirth creates Pascal, a procedural language. Critics immediately denounce Pascal because it uses "x := x + y" syntax instead of the more familiar C-like "x = x + y". This criticism happens in spite of the fact that C has not yet been invented. :-\ http://james-iry.blogspot.com/2009/05/brief-incomplete-and-mostly-wrong.html[^]

                                          The latest nation. Procrastination.

                                          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