hello, Basically what happens is a pointer holds the address of something. So, lets say you create an object, then you delete it. That pointer (unless set to NULL) will still point to the address of where that object used to be. This can be a problem because when you think you are modifying a pointer later on, it could be pointing at object b instead of object a, etc.
Thanks, Tyler Littlefield Web: tysdomain.com email: [email protected] My programs don't have bugs, they're called randomly added features. ----- Original Message ----- From: Robert Ryan To: [email protected] Sent: Tuesday, April 21, 2009 4:56 PM Subject: Re: [c-prog] vector of pointer I am trying to understand pointers. Is a smart pointer the same an an auto_ptr minus the wrapper http://ootips.org/yonat/4dev/smart-pointers.html Dangling pointers. A common pitfall of regular pointers is the dangling pointer: a pointer that points to an object that is already deleted. how can it point to something that has been deleted --- On Tue, 4/21/09, Tyler Littlefield <[email protected]> wrote: From: Tyler Littlefield <[email protected]> Subject: Re: [c-prog] vector of pointer To: [email protected] Date: Tuesday, April 21, 2009, 4:03 PM I forgot: Most APIs and libraries require that you use pointers to pass things around. The windows API is big, you have to know how to use them to use libc, etc etc. It's not something you can avoid, even with smart pointers, as most functions won't accept those. Thanks, Tyler Littlefield Web: tysdomain.com email: ty...@tysdomain. com My programs don't have bugs, they're called randomly added features. ----- Original Message ----- From: Tyler Littlefield To: c-p...@yahoogroups. com Sent: Tuesday, April 21, 2009 3:01 PM Subject: Re: [c-prog] vector of pointer >POINTERS RULE!!!! I haven't been using c/c++ for very long. It's mainly thanks to chris that I use pointers. I had a fobia, but after endless code editing sessions I finally get it. It's not an easy thing to learn, but it makes life so much easier, whether your using c++ or c. I use c more often than not, so I don't have all the OOP ideas, c tends to be more straight forward and easier for me to understand personally. Thanks, Tyler Littlefield Web: tysdomain.com email: ty...@tysdomain. com My programs don't have bugs, they're called randomly added features. ----- Original Message ----- From: mcmprch To: c-p...@yahoogroups. com Sent: Tuesday, April 21, 2009 2:54 PM Subject: Re: [c-prog] vector of pointer One of the good things about learning to code in x86 / z80 asm, then 'C' in the 80's was that optomizing your code just became something you did. It was a necessity because of the slow processor/memory of the time. Think 'direct screen writing' on the old DOS pc's. It's one of the reasons I preach kids to learn 'C' before they learn C++ or Java or C# or VB.NET. These languages breed sloppy, lazy coding (sorry if I offend anyone, but I've got enough years experience now to know that that is a true statement). Part of that is the OOP paradigm we all try to strive for today. It IS a good thing. I agree. The design of systems using OOP techniques is better, easier. But coding should still be second nature to young, up and coming geeks before we teach them design patterns... sorry, having a sloppy code day myself.... POINTERS RULE!!!! Michael Tyler Littlefield wrote: > > > well put, chris. > I think a few people on this list have a pointerfobia. And then again, > there's always the "It's modern technology. What should it matter if > it takes 5 cycles or 500, they are faster than they used to be. > I'd hate to see coding 10 years down the road. > > Thanks, > Tyler Littlefield > Web: tysdomain.com > email: ty...@tysdomain. com <mailto:tyler% 40tysdomain. com> > My programs don't have bugs, they're called randomly added features. > > - > [Non-text portions of this message have been removed] [Non-text portions of this message have been removed] [Non-text portions of this message have been removed] [Non-text portions of this message have been removed]
