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. General Programming
  3. C / C++ / MFC
  4. Is pointers in C++ a headache for real world programmers?

Is pointers in C++ a headache for real world programmers?

Scheduled Pinned Locked Moved C / C++ / MFC
c++javaquestionlounge
13 Posts 12 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.
  • L Link2600

    In Java, they got rid of the use of pointers, and most Java programmers will tell you because the creators want to get rid of the pointers headache for programmers. I wonder if it is true? Is pointers a headache for you? And is it useful? If you don't use pointers, what alternatives do you have? (off topic) By the way, do you happen to know if there is a Java forum that is similar to this site? Thanks.

    Z Offline
    Z Offline
    ZoogieZork
    wrote on last edited by
    #2

    VW_Red_Jetta wrote: By the way, do you happen to know if there is a Java forum that is similar to this site? Try the JDC Forums: http://forum.java.sun.com/[^] - Mike

    1 Reply Last reply
    0
    • L Link2600

      In Java, they got rid of the use of pointers, and most Java programmers will tell you because the creators want to get rid of the pointers headache for programmers. I wonder if it is true? Is pointers a headache for you? And is it useful? If you don't use pointers, what alternatives do you have? (off topic) By the way, do you happen to know if there is a Java forum that is similar to this site? Thanks.

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

      other people's use of pointers is evil, but pointers are wonderful. To vote with no response is to follow the way of the coward.

      L 1 Reply Last reply
      0
      • L Link2600

        In Java, they got rid of the use of pointers, and most Java programmers will tell you because the creators want to get rid of the pointers headache for programmers. I wonder if it is true? Is pointers a headache for you? And is it useful? If you don't use pointers, what alternatives do you have? (off topic) By the way, do you happen to know if there is a Java forum that is similar to this site? Thanks.

        M Offline
        M Offline
        Michael Dunn
        wrote on last edited by
        #4

        VW_Red_Jetta wrote: Is pointers a headache for you? And is it useful? If you don't use pointers, what alternatives do you have? No. Yes. VB X| Java people say that pointers are evil. C++ people say that not controlling when object destructors run is evil. *shrug* --Mike-- Latest blog entry: *drool* (Alyson) [May 10] Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber "You have Erica on the brain" - Jon Sagara to me

        1 Reply Last reply
        0
        • C Chris Losinger

          other people's use of pointers is evil, but pointers are wonderful. To vote with no response is to follow the way of the coward.

          L Offline
          L Offline
          leppie
          wrote on last edited by
          #5

          Chris Losinger wrote: other people's use of pointers is evil, but pointers are wonderful I agree, I dont do c++ but do c, and once you grasp that everything is really just a number and passing-by-reference is complete bollocks, then it all makes sense to you. :)

          leppie::AllocCPArticle(Generic DFA State Machine for .NET);

          1 Reply Last reply
          0
          • L Link2600

            In Java, they got rid of the use of pointers, and most Java programmers will tell you because the creators want to get rid of the pointers headache for programmers. I wonder if it is true? Is pointers a headache for you? And is it useful? If you don't use pointers, what alternatives do you have? (off topic) By the way, do you happen to know if there is a Java forum that is similar to this site? Thanks.

            V Offline
            V Offline
            valikac
            wrote on last edited by
            #6

            C++ pointers are extremely powerful for both software design and implementation. Kuphryn

            1 Reply Last reply
            0
            • L Link2600

              In Java, they got rid of the use of pointers, and most Java programmers will tell you because the creators want to get rid of the pointers headache for programmers. I wonder if it is true? Is pointers a headache for you? And is it useful? If you don't use pointers, what alternatives do you have? (off topic) By the way, do you happen to know if there is a Java forum that is similar to this site? Thanks.

              D Offline
              D Offline
              Daniela123
              wrote on last edited by
              #7

              I do not understand... How can you get anything done without them. and it is not a headache. I think, the reason that JAVA is different from C (C++) in this respect, is security. In C you can assign any number to a pointer and read and write any byte in memory, sometimes with disastrous results. Only hardware memory management can protect us from unauthorized access. But then, I do not know JAVA. Daniela

              1 Reply Last reply
              0
              • L Link2600

                In Java, they got rid of the use of pointers, and most Java programmers will tell you because the creators want to get rid of the pointers headache for programmers. I wonder if it is true? Is pointers a headache for you? And is it useful? If you don't use pointers, what alternatives do you have? (off topic) By the way, do you happen to know if there is a Java forum that is similar to this site? Thanks.

                V Offline
                V Offline
                Vikram A Punathambekar
                wrote on last edited by
                #8

                VW_Red_Jetta wrote: Is pointers a headache for you? No. I can't dream of a fairly large program without pointers. VW_Red_Jetta wrote: And is it useful? See above. VW_Red_Jetta wrote: If you don't use pointers, what alternatives do you have? I dunno. Actually, I had to do a couple of small programs (one in VB, one in Java). I got really pissed off X| - with VB for the language and Java for lack of pointers. C++ is for me. I'm gonna learn C#, though. :)
                Vikram. ----------------------------- My site due for a massive update. "Good lord you yanks are getting worse than a defensive VB developer at a C++ conference." - Paul Watson in the Lounge, 31 May 2003. "Do not give redundant error messages again and again." - A classmate of mine, while giving a class talk on error detection in compiler design.

                1 Reply Last reply
                0
                • L Link2600

                  In Java, they got rid of the use of pointers, and most Java programmers will tell you because the creators want to get rid of the pointers headache for programmers. I wonder if it is true? Is pointers a headache for you? And is it useful? If you don't use pointers, what alternatives do you have? (off topic) By the way, do you happen to know if there is a Java forum that is similar to this site? Thanks.

                  M Offline
                  M Offline
                  Michael P Butler
                  wrote on last edited by
                  #9

                  Pointers are one of the most useful parts of C++/C. Used well, they become one of the most powerful tools in a programmers toolkit - used poorly and they can make your life a living hell. When I first started wiht pointers in the late 80's (in C), it took me a couple of months to understand the concept but now they are second nature. Michael 'War is at best barbarism...Its glory is all moonshine. It is only those who have neither fired a shot nor heard the shrieks and groans of the wounded who cry aloud for blood, more vengeance, more desolation. War is hell.' - General William Sherman, 1879

                  1 Reply Last reply
                  0
                  • L Link2600

                    In Java, they got rid of the use of pointers, and most Java programmers will tell you because the creators want to get rid of the pointers headache for programmers. I wonder if it is true? Is pointers a headache for you? And is it useful? If you don't use pointers, what alternatives do you have? (off topic) By the way, do you happen to know if there is a Java forum that is similar to this site? Thanks.

                    B Offline
                    B Offline
                    Bob Stanneveld
                    wrote on last edited by
                    #10

                    As long as java exists, there's and endless discussion between C/C++ and Java programmers about which language to use. I have some experience with java. I learn it at school, from my point of view, Java programmers are lazy thinkers(no offence) and C/C++ programmers are lazy writing! Back to pointers, I use pointers as much as I can. They keep the mind sharp! In Java they didn't get rid of pointers at all, they just hide them from the programmer. (Ever had a null pointer exception??)

                    P 1 Reply Last reply
                    0
                    • B Bob Stanneveld

                      As long as java exists, there's and endless discussion between C/C++ and Java programmers about which language to use. I have some experience with java. I learn it at school, from my point of view, Java programmers are lazy thinkers(no offence) and C/C++ programmers are lazy writing! Back to pointers, I use pointers as much as I can. They keep the mind sharp! In Java they didn't get rid of pointers at all, they just hide them from the programmer. (Ever had a null pointer exception??)

                      P Offline
                      P Offline
                      Peter Weyzen
                      wrote on last edited by
                      #11

                      First of all, my first misconception about java, was that there were no pointers. That misconception from a C++ point of view led me to believe that you just used copied objects everywhere. Java is all about references -- which really are just smarter pointers. Smart would be pushing it, but smarter... I can't tell you how many hours I've spent debugging java code because it wouldn't release objects. {how smart can it be if you can still screw it up?} I think of Java like I think of PASCAL. Remember PASCAL? It tries real hard to protect you from shooting yourself in the foot, but if you attempt anything too lofty, you will end up shooting yourself in the foot, but not realize it, and then you die a slow but somewhat painless death. Java makes a great teaching language -- as long as you don't really want to understand what's happening under the hood. References live in C++ too, and but they don't do the auto-delete-referenc-counter thingy that java does. MS came out with this thing called COM. COM implements some java-like stuff in C++. Reference counting and smarter casting stuff... My answer is: that I'd much rather use C++. I think it's the control-freak in me, but I know what I am getting with C++. {knowing assembly helps too} Java leaves you greatly at the whim of the person that developed the runtime... The learning curve with C++ is higher. And java has some constructs that are missing in C++ (like "super" -- I love "super"). But I'd still pick C++ any day! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Peter Weyzen Staff Engineer Santa Cruz Networks

                      B 1 Reply Last reply
                      0
                      • P Peter Weyzen

                        First of all, my first misconception about java, was that there were no pointers. That misconception from a C++ point of view led me to believe that you just used copied objects everywhere. Java is all about references -- which really are just smarter pointers. Smart would be pushing it, but smarter... I can't tell you how many hours I've spent debugging java code because it wouldn't release objects. {how smart can it be if you can still screw it up?} I think of Java like I think of PASCAL. Remember PASCAL? It tries real hard to protect you from shooting yourself in the foot, but if you attempt anything too lofty, you will end up shooting yourself in the foot, but not realize it, and then you die a slow but somewhat painless death. Java makes a great teaching language -- as long as you don't really want to understand what's happening under the hood. References live in C++ too, and but they don't do the auto-delete-referenc-counter thingy that java does. MS came out with this thing called COM. COM implements some java-like stuff in C++. Reference counting and smarter casting stuff... My answer is: that I'd much rather use C++. I think it's the control-freak in me, but I know what I am getting with C++. {knowing assembly helps too} Java leaves you greatly at the whim of the person that developed the runtime... The learning curve with C++ is higher. And java has some constructs that are missing in C++ (like "super" -- I love "super"). But I'd still pick C++ any day! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Peter Weyzen Staff Engineer Santa Cruz Networks

                        B Offline
                        B Offline
                        Bob Stanneveld
                        wrote on last edited by
                        #12

                        Well, I remember OBJECT PASCAL. They try to prevent the use of pointers. I couldn't even find information about pointers in the delphi help files! The 'auto-delete-reference-counter thingy' from Java is called the garbage collector. This is one of the many things that make Java a slow language! Some people also tried to implement a garbage collector in C++, but failed at some aspects. The reference counting is done by so-called 'smart pointers'. A topic about C++ garbage collecting and 'smart pointers' is around here somewhere. Almost everyone in my class didn't start their programming experience with C/C++. Almost everyone (with experience) was aquainted with (object) PASCAL, Java, Visual Basic. They all did well, until we got tje subject 'C'. Almost everyone failed at understanding pointers. They didn't know with what the were dealing with (maybe they're just stupid). So my opinion is: If you want to learn how to program, start with C/C++. Why? You don't get used to 'easy' programming and when you know something about C/C++, no other language is hard to learn. They are all easier than C/C++. If you do it the other way around, you still got a hard language to learn! The 'super' keyword is indeed a handy thing, but C++ allows a similar construction! exemple: // base class class A { private: int n; public: A(); int GetInt(); }; A::A() { n = 1; } int A::GetInt() { return n; } // derived class class B : public A { private: double b; public: B(); double GetDouble(); } // You can call a inherited constructor in 2 ways: // 1) this method doesn't work with other functions, only the constructor!! B::B() : A() { // The first thing that is done, is the call to A(), afterwards this code // is executed d = 1.1; } // 2) this method works with all types of functions B::B() { d = 1.1; A::A(); // 'A::' is the C++ version of 'super' // this is just a normal function call, and can be placed // anywhere, where a statement would be legal! } Did you know that there is a way to interface assembly with C/C++? This can be achieved by using the __asm keyword. Consult your help or the online msdn library for more details

                        1 Reply Last reply
                        0
                        • L Link2600

                          In Java, they got rid of the use of pointers, and most Java programmers will tell you because the creators want to get rid of the pointers headache for programmers. I wonder if it is true? Is pointers a headache for you? And is it useful? If you don't use pointers, what alternatives do you have? (off topic) By the way, do you happen to know if there is a Java forum that is similar to this site? Thanks.

                          G Offline
                          G Offline
                          geo_m
                          wrote on last edited by
                          #13

                          Well, languages that hide pointers, they are similar for me to having some car with engine capable to run 300kmph, but the car vendor decided for you X|, that it is dangerous and you cannot do it and forced some limitation to the car, that you can now drive max. 130kmph. Yes, it is safe, and it will protect some people from being hurt, but it also hides some part of power inside the thing and you are not able to use it even on a racing polygon.

                          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