|
-
May 28th, 2009, 11:15 AM
#17
Re: pointers--when to use them
 Originally Posted by laserlight
I did not talk about objectives. Rather, I talked about pointer arithmetic. You simply cannot "increment" or "advance" a reference, or "subtract" references in C# and Java.
Well, so did I but I got dragged into it. 
I only mentioned 2 ways to model something. There could be a disjoint set of baggage that comes along with those different models. So, comparing them was not my point. Ultimately, what matters is how you are using something to achieve the application requirements. It might have been an understatement on my part to say that there was only one difference but that was used as an example to illustrate a more general point I was putting up.
Trying to modify the way C++ references work in C++ in any way is not a trivial task to do, it would need lots of thoughts and is a hypothetical case. I was just merely stating that pointers or references are just different ways to implement a concept: "address of an object". There might be nitty-gritties involved that are peculiar to one particular implementation. If both implementations were the same, why would you need 2 different implementations? That would be an overhead, we could easily work without.
But if you ask me what is the most important different between a reference and a pointer in C++: I still maintain the view that NULLability is the one. But that is just my view and people may differ.
Can you help me with my homework assignment?, Before you post!, Use code tags, How to post!, Codeguru technical FAQs, C++ FAQ Lite, Stroustrup: C++ Style and Technique FAQ, Guru of the Week, Comeau C and C++ FAQs, Comeau C++ Templates FAQs, CUJ @ DDJ, Spam threshold
My Blogs : Learning C++ is fun | Abnegator's reflections
Open Threads : C++ Aha! Moments | Nature of work in C++?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|