473,386 Members | 1,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Reference and Pointer

What is the difference between a reference and a pointer?

Apr 17 '06 #1
51 4376
Kuku <me******@yahoo.com> wrote:
What is the difference between a reference and a pointer?


Did you even bother trying Google?
--
jb

(reply address in rot13, unscramble first)
Apr 17 '06 #2
You had problems in answering it??

Apr 17 '06 #3
* Kuku:
You had problems in answering it??


It's a complete-newbie question, and he isn't.

Why don't you try Google? Or this group's FAQ, perhaps?

Always check the FAQ (and Google) before posting.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Apr 17 '06 #4
What's the link to the FAQ?

And thanks.. this was a better way of saying it

Apr 17 '06 #5
Kuku wrote:
What is the difference between a reference and a pointer?


What does your tutorial tell you about them?

--
Phlip
http://www.greencheese.org/ZeekLand <-- NOT a blog!!!
Apr 17 '06 #6
Kuku <me******@yahoo.com> wrote:
What's the link to the FAQ?


http://www.google.com/search?q=c%2B%2B+faq

--
Marcus Kwok
Replace 'invalid' with 'net' to reply
Apr 17 '06 #7

Kuku wrote:
What is the difference between a reference and a pointer?


http://www.parashift.com/c++-faq-lite/references.html

That is the best you will find on the comparison in the faq.

Apr 17 '06 #8
Noah Roberts wrote:
Kuku wrote:
What is the difference between a reference and a pointer?

http://www.parashift.com/c++-faq-lite/references.html

That is the best you will find on the comparison in the faq.


I have programmed for a couple of months in C and it's this automatic
dereferencing when you pass by reference I find most confusing, because
here C and C++ doesn't work out the same way....
Best regards / Med venlig hilsen
Martin Jørgensen

--
---------------------------------------------------------------------------
Home of Martin Jørgensen - http://www.martinjoergensen.dk
Apr 17 '06 #9
Martin Jørgensen wrote:
Noah Roberts wrote:
Kuku wrote:
What is the difference between a reference and a pointer?

http://www.parashift.com/c++-faq-lite/references.html

That is the best you will find on the comparison in the faq.


I have programmed for a couple of months in C and it's this automatic
dereferencing when you pass by reference I find most confusing,
because here C and C++ doesn't work out the same way....


I don't understand what you mean. C has no references, and passing
pointers in C++ works the same way as in C. There is no "it" to work
out differently.

Brian
Apr 17 '06 #10
Default User wrote:
Martin Jørgensen wrote:
I have programmed for a couple of months in C and it's this automatic
dereferencing when you pass by reference I find most confusing,
because here C and C++ doesn't work out the same way....


I don't understand what you mean. C has no references, and passing
pointers in C++ works the same way as in C. There is no "it" to work
out differently.


One might try to explain references to a C programmer as "pointers that
automatically dereference themselves". (Yes, I know that isn't accurate
in all contexts.) Based on his comments, Martin Jørgensen is likely
working with that mental model.

Alan
Apr 17 '06 #11
Alan Johnson wrote:
Default User wrote:
Martin Jørgensen wrote:
I have programmed for a couple of months in C and it's this
automatic dereferencing when you pass by reference I find most
confusing, because here C and C++ doesn't work out the same
way....


I don't understand what you mean. C has no references, and passing
pointers in C++ works the same way as in C. There is no "it" to work
out differently.


One might try to explain references to a C programmer as "pointers
that automatically dereference themselves". (Yes, I know that isn't
accurate in all contexts.) Based on his comments, Martin Jørgensen is
likely working with that mental model.

Which would be fine, but what the heck does "because here C and C++
doesn't work out the same way" mean? Passing pointers works the same.
If he meant that pointers and references aren't the same, then yeah.
Let's stick with that and leave differences between the languages out
of it.

Brian
Apr 17 '06 #12
Default User wrote:
Alan Johnson wrote:

Default User wrote:
Martin Jørgensen wrote:

I have programmed for a couple of months in C and it's this
automatic dereferencing when you pass by reference I find most
confusing, because here C and C++ doesn't work out the same
way....

I don't understand what you mean. C has no references, and passing
pointers in C++ works the same way as in C. There is no "it" to work
out differently.

One might try to explain references to a C programmer as "pointers
that automatically dereference themselves". (Yes, I know that isn't
accurate in all contexts.) Based on his comments, Martin Jørgensen is
likely working with that mental model.


Exactly... And I can't get it out of my head, but perhaps it will go
away with time :-)
Which would be fine, but what the heck does "because here C and C++
doesn't work out the same way" mean? Passing pointers works the same.
I believe in C you would get either a compiler error or warning if you
don't dereference the pointer when you want to access the value of the
pointer (in C). That same thing is also a reference (in C++) and that's
the difference!
If he meant that pointers and references aren't the same, then yeah.


I mean: "Automatic dereferencing" like I wrote. When you write something
with & in front of it, you're actually passing the address of that
variable and not the value of the variable.
Best regards / Med venlig hilsen
Martin Jørgensen

--
---------------------------------------------------------------------------
Home of Martin Jørgensen - http://www.martinjoergensen.dk
Apr 18 '06 #13
Martin Jørgensen wrote;
One might try to explain references to a C programmer as "pointers
that automatically dereference themselves". (Yes, I know that isn't
accurate in all contexts.) Based on his comments, Martin Jørgensen is
likely working with that mental model.


Exactly... And I can't get it out of my head, but perhaps it will go away
with time :-)


The fix is "a reference is another name for an object; an alias for that
object".

By "object" we also mean items with built-in types...

--
Phlip
http://www.greencheese.org/ZeekLand <-- NOT a blog!!!
Apr 18 '06 #14
Martin Jørgensen wrote:
Default User wrote:
Which would be fine, but what the heck does "because here C and C++
doesn't work out the same way" mean? Passing pointers works the
same.


I believe in C you would get either a compiler error or warning if
you don't dereference the pointer when you want to access the value
of the pointer (in C).


Huh? Could you give some code example? Pointers work virtually
identically in the two languages. The sole exception I can think of is
automatic conversion of void* to object pointers in C.
That same thing is also a reference (in C++)
and that's the difference!


I don't know what you mean. References are NOT pointers, regardless of
how they might be implemented. There is no pass by reference in C, and
pointers (which are passed by value) work the same in either language.

Somebody's confused. Maybe me.
If he meant that pointers and references aren't the same, then yeah.


I mean: "Automatic dereferencing" like I wrote. When you write
something with & in front of it, you're actually passing the address
of that variable and not the value of the variable.


Sure, but what does that have to do with anything? What "difference"
between the languages are you talking about? There are differences
between pointers and references, but that's not a language difference,
other than C ain't got 'em (references).

Brian
Apr 18 '06 #15
Phlip wrote:
Martin Jørgensen wrote;

One might try to explain references to a C programmer as "pointers
that automatically dereference themselves". (Yes, I know that isn't
accurate in all contexts.) Based on his comments, Martin Jørgensen is
likely working with that mental model.


Exactly... And I can't get it out of my head, but perhaps it will go away
with time :-)

The fix is "a reference is another name for an object; an alias for that
object".

By "object" we also mean items with built-in types...


Yeah, I know it... I'm a bit more used to C than C++, but I know it :-)
Best regards / Med venlig hilsen
Martin Jørgensen

--
---------------------------------------------------------------------------
Home of Martin Jørgensen - http://www.martinjoergensen.dk
Apr 18 '06 #16
Default User wrote:
-snip-
Sure, but what does that have to do with anything? What "difference"
between the languages are you talking about? There are differences
between pointers and references, but that's not a language difference,
other than C ain't got 'em (references).


If it isn't a language difference, what the hell is it then?
Best regards / Med venlig hilsen
Martin Jørgensen

--
---------------------------------------------------------------------------
Home of Martin Jørgensen - http://www.martinjoergensen.dk
Apr 18 '06 #17
Martin Jørgensen wrote:
Default User wrote:
-snip-
Sure, but what does that have to do with anything? What "difference"
between the languages are you talking about? There are differences
between pointers and references, but that's not a language
difference, other than C ain't got 'em (references).


If it isn't a language difference, what the hell is it then?


You tell me. What difference between the way pointers are handled have
you detected between the two languages.

I'll remind you again, references are not pointers. You're hung up on a
mythical automatic dereferencing that doesn't exist.

Brian
Apr 18 '06 #18
Default User wrote:
Martin Jørgensen wrote:
Default User wrote:
-snip-
> Sure, but what does that have to do with anything? What "difference"
> between the languages are you talking about? There are differences
> between pointers and references, but that's not a language
> difference, other than C ain't got 'em (references).


If it isn't a language difference, what the hell is it then?


You tell me. What difference between the way pointers are handled have
you detected between the two languages.

I'll remind you again, references are not pointers. You're hung up on a
mythical automatic dereferencing that doesn't exist.


No he isn't. He is just coming to terms with the fact that in C++ you can
write

hm = foo( bar );

and you are not able to tell wether bar is passed by value or by reference,
i.e., when you are calling a function, there is no indication of its side
effects on arguments. The difference between the languages that he is
struggling with is exactly that C++ has call by value *and* call by
reference -- and that the decision is made is at the point of declaration
not at the point of use.

Of course, C++ wouldn't be C++ if life didn't get more complicated: foo
could also be a function object and the call could have side effects there,
too.
Best

Kai-Uwe Bux
Apr 18 '06 #19
Kai-Uwe Bux wrote:
Default User wrote: -snip-
Sure, but what does that have to do with anything? What "difference"
between the languages are you talking about? There are differences
between pointers and references, but that's not a language
difference, other than C ain't got 'em (references).

If it isn't a language difference, what the hell is it then?


You tell me. What difference between the way pointers are handled have
you detected between the two languages.
Instead of answering the question you're asking me another question - do
you think I'll forget I actually asked you a question, which you
apparently couldn't answer reasonable?

At least you could learn to program in C before you write such bullshit,
so you would actually be aware of the language difference...
I'll remind you again, references are not pointers. You're hung up on a
mythical automatic dereferencing that doesn't exist.


Bullshit. First of all:

I can't take you seriously. I *NEVER* wrote that references are
pointers! Grow up, little child and learn to read too!
No he isn't. He is just coming to terms with the fact that in C++ you can
write

hm = foo( bar );

and you are not able to tell wether bar is passed by value or by reference,
i.e., when you are calling a function, there is no indication of its side
effects on arguments. The difference between the languages that he is
struggling with is exactly that C++ has call by value *and* call by
reference -- and that the decision is made is at the point of declaration
not at the point of use.
I think that's true... I still like to think of it this way, as I wrote
before:

In C you would get either a compiler error or warning if you don't
dereference the pointer when you want to access the value of the
pointed-to-value (the pointer in C). That same thing is _a reference_
(in C++).

So in C++ you don't have to dereference when you pass by reference (i.e.
you pass the address of the variable) but you have to do that in C - and
that's CLEARLY a *language* difference! Therefore this is "automatic
dereferencing" seen from a C programmers point of view...

Doesn't matter which way one thinks of it though - as long as the final
result is the same and it works - and I believe this way of "thinking of
it" works for me (i.e. automatic dereferencing), so that's enough for
me. But:

As Philip wrotes: The fix is "a reference is another name for an object; an alias for that object".

And that's just the same thing seen from a different perspective and I
totally agree with him and am aware of that (the last "fix" is easier to
think of in general which I also do sometimes, as I wrote earlier).
Of course, C++ wouldn't be C++ if life didn't get more complicated: foo
could also be a function object and the call could have side effects there,
too.


This difference between the languages is *really* something that I've
been thinking a lot about - and which was a bit hard to accept earlier.
I mean: You can't stop anwering yourself - why doesn't it work the same
way in the two languages??? It just don't.

Conclusion: Well mainly for the OP:

If you also have a background in C like me, and you use references as
arguments to functions in C++ you have to "switch mind" into a different
way of thinking - and the easiest way of understanding it, would
probably be to use "Philip's fix".

As long as you are aware of the difference/similarities I think it's
much easier to avoid mistakes, so that's also why I wrote about this
"difference".

If you don't have a background in C, there's probably no confusion at
all and then you shouldn't worry...
Best regards / Med venlig hilsen
Martin Jørgensen

--
---------------------------------------------------------------------------
Home of Martin Jørgensen - http://www.martinjoergensen.dk
Apr 20 '06 #20
Martin Jørgensen wrote:
Doesn't matter which way one thinks of it though - as long as the final
result is the same and it works - and I believe this way of "thinking of
it" works for me (i.e. automatic dereferencing), so that's enough for
me.
Well, as soon as you offer in this forum the way of thinking that works for
you as an explanation (to others), you have to be prepared that you might
be criticized if your explanations are regarded sloppy or misleading.

I think the following two paragraphs explain why you are getting yourself
into some deep waters in this group:

Martin Jørgensen wrote:
[snip] In C you would get either a compiler error or warning if you don't
dereference the pointer when you want to access the value of the
pointed-to-value (the pointer in C). That same thing is _a reference_
(in C++).
Parsed literally, this is not true: "That same thing" is actually the same
in C++: if you try to access the value of the pointed-to-value, you have to
dereference the pointer. No difference.

So in C++ you don't have to dereference when you pass by reference (i.e.
you pass the address of the variable) but you have to do that in C - and
that's CLEARLY a *language* difference! Therefore this is "automatic
dereferencing" seen from a C programmers point of view...
This also does not quite parse: the elliptic sentence "but you have to do
that in C" expands to:

In C you have to dereference when you pass by reference.

Now that does no make sense since, in C you cannot pass by reference.
Relax: I understand what you mean and I also understand that, how, and why
this picture works for you. But please accept that as soon as you put it
into words and offer it on this group, people will take your words apart
and point out technical and logical inaccuracies.

If you don't have a background in C, there's probably no confusion at
all and then you shouldn't worry...


Right. Lucky me.
Best

Kai-Uwe Bux
Apr 20 '06 #21
Kai-Uwe Bux wrote:
I think the following two paragraphs explain why you are getting yourself
into some deep waters in this group:
"Argumentum ad populum" noted. Nobody is busting on Martin here except you.
Martin Jørgensen wrote:
In C you would get either a compiler error or warning if you don't
dereference the pointer when you want to access the value of the
pointed-to-value (the pointer in C). That same thing is _a reference_
(in C++).

Parsed literally, this is not true: "That same thing" is actually the same
in C++: if you try to access the value of the pointed-to-value, you have
to
dereference the pointer. No difference.


Martin's statement is simply ambiguous, and he obviously knows the correct
version. If you gracefully accept the interpretation that's closer to C++
canon, then the thread can easily progress.

When someone is learning how to write about a language, and they write an
ambiguous sentence, politely coaching them to correct the ambiguity is much
better than repeatedly accusing them of the wrong interpretation. Fun though
it is.

--
Phlip
http://www.greencheese.org/ZeekLand <-- NOT a blog!!!
Apr 20 '06 #22
Phlip wrote:
Kai-Uwe Bux wrote:
I think the following two paragraphs explain why you are getting yourself
into some deep waters in this group:


"Argumentum ad populum" noted. Nobody is busting on Martin here except
you.


Are you really addressing me? The heat was mainly between Default User and
Martin, not me. If you reread the thread you will find that I am not
busting Martin at all. All I tried was to explain which kind of words on
Martins part triggered the responses he got (from others).

Also, "argumentum ad populum" would be "you are wrong because the majority
here says so". This is not what I argued. I argued that writing things that
do not quite come out exactly right run a high risk is this group of
triggering harsh criticism. The direction of inference/explanation that I
was using is exactly the opposite to argumentum ad populum.

Martin Jørgensen wrote:

In C you would get either a compiler error or warning if you don't
dereference the pointer when you want to access the value of the
pointed-to-value (the pointer in C). That same thing is _a reference_
(in C++).

Parsed literally, this is not true: "That same thing" is actually the
same in C++: if you try to access the value of the pointed-to-value, you
have to
dereference the pointer. No difference.


Martin's statement is simply ambiguous, and he obviously knows the correct
version. If you gracefully accept the interpretation that's closer to C++
canon, then the thread can easily progress.

When someone is learning how to write about a language, and they write an
ambiguous sentence, politely coaching them to correct the ambiguity is
much better than repeatedly accusing them of the wrong interpretation. Fun
though it is.


"politely coaching them to correct the ambiguity" is exactly what I did.
Reread *my* posts and if you can, point out a place where I was impolite.
Best

Kai-Uwe Bux
Apr 20 '06 #23
Kai-Uwe Bux wrote:
Martin Jørgensen wrote:
Doesn't matter which way one thinks of it though - as long as the final
result is the same and it works - and I believe this way of "thinking of
it" works for me (i.e. automatic dereferencing), so that's enough for
me.

Well, as soon as you offer in this forum the way of thinking that works for
you as an explanation (to others), you have to be prepared that you might
be criticized if your explanations are regarded sloppy or misleading.

I think the following two paragraphs explain why you are getting yourself
into some deep waters in this group:


I don't think I'm into some deep water, but lets discuss it then.
Martin Jørgensen wrote:
[snip]
In C you would get either a compiler error or warning if you don't
dereference the pointer when you want to access the value of the
pointed-to-value (the pointer in C). That same thing is _a reference_
(in C++).

Parsed literally, this is not true: "That same thing" is actually the same
in C++: if you try to access the value of the pointed-to-value, you have to


No. "That same thing" is not the same in C as in C++. In the C++
language it's a reference! "Default user" even agrees with me a bit,
since earlier he wrote that: "There is no pass by reference in C".
dereference the pointer. No difference.
I can't believe you're actually writing that there isn't any difference!

I'm writing that there *IS* a very clear difference. I don't think you
read it correctly. We're discussing using the &-operator. And if you
think it works the same way in C as in C++, when you pass a variable
into a function with the &-operator, then you're completely wrong.

Let me point this completely out for you:

1) In C you pass the address of the variable value.
2) In C++ You pass the value by reference.

I've already explained this and other people seem to have understood it
completely correctly and as I believe I also previously explained it.

And you don't see any difference?

OMFG... Not strange that you can't see that in C you would need to
dereference a pointer (containing the address of the variable) while in
C++ it's like having "automatic dereferencing" of a pointer-to-variable,
so to speak - in C-terms...

In general: You really need to understand this difference, if you want
to understand the whole idea here...
So in C++ you don't have to dereference when you pass by reference (i.e.
you pass the address of the variable) but you have to do that in C - and
that's CLEARLY a *language* difference! Therefore this is "automatic
dereferencing" seen from a C programmers point of view...

This also does not quite parse: the elliptic sentence "but you have to do
that in C" expands to:

In C you have to dereference when you pass by reference.


What you're writing doesn't make any sense! I'm not writing whatever you
claim with the above, since it's completely nonsense!
Now that does no make sense since, in C you cannot pass by reference.
If it doesn't make any sense, then why did you write this nonsense then,
in the first place? I don't think I ever wrote this nonsense that you
claim I wrote.
Relax: I understand what you mean and I also understand that, how, and why
this picture works for you. But please accept that as soon as you put it
I don't think you understand it, because what you're writing is nonsense
and I can't recognize that what you're writing about should have
originated from my posts...
into words and offer it on this group, people will take your words apart
and point out technical and logical inaccuracies.


I only see 2 persons in this thread that claims that C and C++ works out
completely the same way in this discussion (regarding dereferencing /
"automatic derefencing"):

You and "Default user". I believe other people understand the point...

I can't see these "logical inaccuracies" you're talking about, although
I can see that your last post contains some nonsense - I think you
misread what I wrote somewhere earlier...

This is however unclear to me: I'm not sure about where it is that you
didn't understood or agreed to what I wrote earlier - so where is it,
precisely???

But ofcourse it's no big deal if something was inaccurate written -
you're just fundamentally wrong when you say that there no difference
between passing something to a function in C and C++. And I can't
believe you didn't understood that, because I think I wrote it pretty
clearly previously...
If you don't have a background in C, there's probably no confusion at
all and then you shouldn't worry...

Right. Lucky me.


I think it's nice to understand the difference if the OP have a
background in C and want to learn C++, exactly like myself... That's why
I brought the topic up in the first place.

It's no big deal however since understanding "pass-by-value" and
"pass-by-reference" isn't "rocket science" or very difficult in the
first place, so it's just another perspective on the "Reference vs.
pointer"-discussion - accordingly to the thread subject...
Best regards / Med venlig hilsen
Martin Jørgensen

--
---------------------------------------------------------------------------
Home of Martin Jørgensen - http://www.martinjoergensen.dk
Apr 20 '06 #24
Kai-Uwe Bux wrote:
Also, "argumentum ad populum" would be "you are wrong because the majority
here says so". This is not what I argued. I argued that writing things
that
do not quite come out exactly right run a high risk is this group of
triggering harsh criticism. The direction of inference/explanation that I
was using is exactly the opposite to argumentum ad populum.


You started with the assumption that any quorum here though Martin was
wrong.

However, consider my flames^W attempts to help retracted from you and
directed at Default User! Mostly. ;-)

--
Phlip
http://www.greencheese.org/ZeekLand <-- NOT a blog!!!
Apr 20 '06 #25
Kai-Uwe Bux wrote:
Phlip wrote:
Kai-Uwe Bux wrote:
I think the following two paragraphs explain why you are getting

yourself >> into some deep waters in this group:

"Argumentum ad populum" noted. Nobody is busting on Martin here
except you.


Are you really addressing me? The heat was mainly between Default
User and Martin, not me. If you reread the thread you will find that
I am not busting Martin at all. All I tried was to explain which kind
of words on Martins part triggered the responses he got (from others).


I'm not angry with nor attempting to rail on Martin. In my view, he has
some confused ideas (although quite possibly it is a failure by me to
understand his ideas). I'm attempting to get him to see what I consider
the more correct way of looking at the situation. In particular, to
separate references and pointers in his mind. References are
references, and have their own syntax, what pointers do or do not do
shouldn't be a concern.

Pointers and references have their own particular use cases, although
various people disagree where that dividing line is sometimes.

I've been concerned about his statements about differences between C
and C++, because I thought he had a misconception about how things
worked. He just needs to leave C out of it, as it really doesn't come
into the picture. In this case, C really is a subset. It doesn't have
references, and pointers work the same way in either language.

Brian
Apr 20 '06 #26
Martin Jørgensen wrote:
Kai-Uwe Bux wrote:
Martin Jørgensen wrote:
In C you would get either a compiler error or warning if you don't
dereference the pointer when you want to access the value of the
pointed-to-value (the pointer in C). That same thing is _a
reference_ (in C++).

Parsed literally, this is not true: "That same thing" is actually
the same in C++: if you try to access the value of the
pointed-to-value, you have to


No. "That same thing" is not the same in C as in C++. In the C++
language it's a reference! "Default user" even agrees with me a bit,
since earlier he wrote that: "There is no pass by reference in C".


That was a factual statement. It has a corollary statement, "pointers
work the same way in the two languages."

In C, "pass by reference" is somewhat simulated by passing (by value)
pointers. The very same method can be used with no difference in C++.
C++ then also has a separate method for actual passing by reference,
references.

dereference the pointer. No difference.


I can't believe you're actually writing that there isn't any
difference!


There is no difference.
I'm writing that there IS a very clear difference. I don't think you
read it correctly. We're discussing using the &-operator. And if you
think it works the same way in C as in C++, when you pass a variable
into a function with the &-operator, then you're completely wrong.
There is no difference in the way the address-of (&) operator works. It
so happens that the symbol & is also used in reference declarations.
It's a different thing though.
Let me point this completely out for you:

1) In C you pass the address of the variable value.
2) In C++ You pass the value by reference.
Or in C++ you pass the address of the variable. Perfectly legal.
I've already explained this and other people seem to have understood
it completely correctly and as I believe I also previously explained
it.

And you don't see any difference?

OMFG... Not strange that you can't see that in C you would need to
dereference a pointer (containing the address of the variable) while
in C++ it's like having "automatic dereferencing" of a
pointer-to-variable, so to speak - in C-terms...
Well, "like" to a certain degree.
I only see 2 persons in this thread that claims that C and C++ works
out completely the same way in this discussion (regarding
dereferencing / "automatic derefencing"):

You and "Default user". I believe other people understand the point...
I believe that is a misrepresentation of what I've said.

I think it's nice to understand the difference if the OP have a
background in C and want to learn C++, exactly like myself... That's
why I brought the topic up in the first place.


I DO have a background in C. I still haven't figured out the
differences you think you see, other than C doesn't have references.


Brian
Apr 20 '06 #27
Default User wrote:
Kai-Uwe Bux wrote:
Phlip wrote:
> Kai-Uwe Bux wrote:
>
>> I think the following two paragraphs explain why you are getting

yourself >> into some deep waters in this group:
>
> "Argumentum ad populum" noted. Nobody is busting on Martin here
> except you.


Are you really addressing me? The heat was mainly between Default
User and Martin, not me. If you reread the thread you will find that
I am not busting Martin at all. All I tried was to explain which kind
of words on Martins part triggered the responses he got (from others).


I'm not angry with nor attempting to rail on Martin.


I understand that. Same here. But his posts show, I think, that he feels
differently about our posts. Conceivably, some words in our posts could be
taken the wrong way.
[parts of agreement snipped]
Best

Kai-Uwe Bux

Apr 20 '06 #28
Phlip wrote:
Kai-Uwe Bux wrote:
Also, "argumentum ad populum" would be "you are wrong because the
majority here says so". This is not what I argued. I argued that writing
things that
do not quite come out exactly right run a high risk is this group of
triggering harsh criticism. The direction of inference/explanation that I
was using is exactly the opposite to argumentum ad populum.


You started with the assumption that any quorum here though Martin was
wrong.


Really -- where? I think, I just noted that he received criticism. No
counting involved. Then, I figured which formulations triggered the
criticism and tried to straighten them out. Deplorably, Martins latest
response to my post shows that I did not succeed. Maybe, you could try
"politely coaching them to correct the ambiguity".
[snip]

Best

Kai-Uwe Bux
Apr 20 '06 #29

Martin Jørgensen wrote:
I'm writing that there *IS* a very clear difference. I don't think you
read it correctly. We're discussing using the &-operator. And if you
think it works the same way in C as in C++, when you pass a variable
into a function with the &-operator, then you're completely wrong.

Let me point this completely out for you:

1) In C you pass the address of the variable value.
2) In C++ You pass the value by reference.


I believe the issue is where you put the "& operator" (as you call it).
Also when discussing this from a C++ point of you, you need to
introduce slightly different teminalogy.

There is _NO_ difference betwen C and C++ in the following regards:

1) Pass by value - same in C and C++

Example:
void foo( int i );
...
int x = 5;
foo( x );

2) Pass by pointer - same in C and C++

Example
void foo( int *i ) { *i = 5; }
...
int x = 10;
foo( &x );

Now there is a big difference between C and C++ in regards to "pass by
reference": It simply doesn't exist in C.

Example:
void foo( int & i ) { i = 10; }
...
int x = 10;
foo( x ); // <-- no "&" at call time

Where you seem to use the wrong terminalogy is that you insist there is
"automatic dereferencing" going on in the "pass by reference". But
you're not passing in a pointer. There is nothing to "dereference". You
are passing in an alias to the object, not a pointer.

In C++, if a function is declared thusly:
void foo( int & i );

You CANNOT call it like this:
int x = 10;
foo( &x );

Since the question was asked about C++ in a C++ newsgroup. You have to
distinguish and define the three methods separately.

Cheers,
Andre

Apr 20 '06 #30
Kai-Uwe Bux wrote:
Default User wrote:

I'm not angry with nor attempting to rail on Martin.


I understand that. Same here. But his posts show, I think, that he
feels differently about our posts. Conceivably, some words in our
posts could be taken the wrong way.


I'm sure. As always, it's an impersonal medium at best. At worst, every
little instance of poor wording can rankle or seem like an attack.

I believe there's plenty of violent agreement and a modicum of
miscommunication going on.


Brian
Apr 20 '06 #31
Martin Jørgensen wrote:
Kai-Uwe Bux wrote:
Martin Jørgensen wrote:
Doesn't matter which way one thinks of it though - as long as the final
result is the same and it works - and I believe this way of "thinking of
it" works for me (i.e. automatic dereferencing), so that's enough for
me.

Well, as soon as you offer in this forum the way of thinking that works
for you as an explanation (to others), you have to be prepared that you
might be criticized if your explanations are regarded sloppy or
misleading.

I think the following two paragraphs explain why you are getting yourself
into some deep waters in this group:


I don't think I'm into some deep water, but lets discuss it then.


Ok. However, we seem to have a certain difficulty in communicating. Please
keep in mind that nothing I wrote nor anything I am about to write is meant
to offend you. All I am trying is to get certain wordings straight.

Martin Jørgensen wrote:
[snip]
In C you would get either a compiler error or warning if you don't
dereference the pointer when you want to access the value of the
pointed-to-value (the pointer in C). That same thing is _a reference_
(in C++).

Ok, these were your original words. I would like to start with the
observation that the first sentence is true and stays true if you replace C
by C++:

In C++ you would get either a compiler error or warning if you don't
dereference the pointer when you want to access the value of the
pointed-to-value (the pointer in C++).

Therefore, the first sentence is a little bit awkward a sentence to start a
paragraph that is meant to pinpoint a difference between C an C++.

Now the second sentence: "That same thing is a reference in C++". For this
one, I just would like to ask what the phrase "That same thing" is supposed
to refer to. It should be something mentioned in the first sentence, right?
Ok. Make your pick and find something in the first sentence that completes
the pattern
_________________ is a reference in C++.
I cannot find anything mentioned in the first sentence that matches this
requirement. The natural candidate would be the phrase "the pointer in C".
Then we would read:
the pointer in C is a reference in C++.

Now that line is odd, because C++ has pointers and those pointers work
exactly the same like pointers in C. So a pointer in C really corresponds
to a pointer in C++ and a reference in C++ simply has no counterpart in C.

Parsed literally, this is not true: "That same thing" is actually the
same in C++: if you try to access the value of the pointed-to-value, you
have to


No. "That same thing" is not the same in C as in C++. In the C++
language it's a reference! "Default user" even agrees with me a bit,
since earlier he wrote that: "There is no pass by reference in C".


Clearly, I did not understand what the phrase "That same thing" was supposed
to refer to.

dereference the pointer. No difference.


I can't believe you're actually writing that there isn't any difference!


Please, do no exaggerate my claims. Of course the is a difference between C
and C++. And we already agreed on a wording to describe it:

C++ has call by value and call by reference whereas C only has
call by value.

All the fuzz is just about the *additional* explanations that you propose.

I'm writing that there *IS* a very clear difference. I don't think you
read it correctly. We're discussing using the &-operator. And if you
think it works the same way in C as in C++, when you pass a variable
into a function with the &-operator, then you're completely wrong.
Hm, the only difference in how the &-operator *works* in C and C++ is that
you can overload operator&() in C++. The workings of the &-operator are
exactly the same: in both languages, it returns a pointer to the object
specified by its argument.

In particular, *when you pass a variable into a function with the
&-operator*, there is no difference in the C and C++ will handle this
function call (unless operator& was overloaded in C++). The difference
between the two languages is not something that shows *when you pass a
variable into a function with the &-operator*.
Let me point this completely out for you:

1) In C you pass the address of the variable value.
2) In C++ You pass the value by reference.
Incomplete. Instead it should read:

If you want to call a function that modifies an object from the ambient
scope:
1) In C you pass the address of the object.
2) In C++ you do the same, or alternatively, you pass a reference for
the object. Which way you have to go is determined by the signature.
[snip]
And you don't see any difference?
I do. See above. The question is not *whether* there is a difference, but
how to phrase it.
OMFG... Not strange that you can't see that in C you would need to
dereference a pointer (containing the address of the variable) while in
C++ it's like having "automatic dereferencing" of a pointer-to-variable,
so to speak - in C-terms...
I do see that. I just don't find that wording particularly helpful.
Moreover, this mental model led you to claims like: there is a difference
in how operator& works in C and C++ (besides its capacity for being
overloaded). Such claim is just false and a mental model leading to such
statements is of questionable value.
[snip]
But ofcourse it's no big deal if something was inaccurate written -
you're just fundamentally wrong when you say that there no difference
between passing something to a function in C and C++.


I did not say that. I wrote there is no difference with regard to the
following statement:

In C you would get either a compiler error or warning if you don't
dereference the pointer when you want to access the value of the
pointed-to-value (the pointer in C).

I do not think that one should explain a language *difference* using
sentences about C that just literally stay true when you replace C with
C++.
Best

Kai-Uwe Bux


Apr 21 '06 #32
in*****@gmail.com wrote:
Martin Jørgensen wrote: -snip-
Where you seem to use the wrong terminalogy is that you insist there is
"automatic dereferencing" going on in the "pass by reference". But
you're not passing in a pointer. There is nothing to "dereference". You
are passing in an alias to the object, not a pointer.
I really can't understand that. If you pass the address of a variable
then you *need* to dereference it, so get the value of that address.
In C++, if a function is declared thusly:
void foo( int & i );

You CANNOT call it like this:
int x = 10;
foo( &x );


I never wrote that.
Best regards / Med venlig hilsen
Martin Jørgensen

--
---------------------------------------------------------------------------
Home of Martin Jørgensen - http://www.martinjoergensen.dk
Apr 21 '06 #33
Kai-Uwe Bux wrote:
Martin Jørgensen wrote:
-snip-
In C you would get either a compiler error or warning if you don't
dereference the pointer when you want to access the value of the
pointed-to-value (the pointer in C). That same thing is _a reference_
(in C++).

Ok, these were your original words. I would like to start with the
observation that the first sentence is true and stays true if you replace C
by C++:

In C++ you would get either a compiler error or warning if you don't
dereference the pointer when you want to access the value of the
pointed-to-value (the pointer in C++).


I don't see why you want to replace C by C++. Can you tell me why? I
don't see any problem with the original construction of the words...
Therefore, the first sentence is a little bit awkward a sentence to start a
paragraph that is meant to pinpoint a difference between C an C++.
I can't see that.
Now the second sentence: "That same thing is a reference in C++". For this
one, I just would like to ask what the phrase "That same thing" is supposed
to refer to. It should be something mentioned in the first sentence, right?
Yes! The pointer points to the address of the variable that is passed to
some function... That's why this sign "&" means the "address-of-operator".

And that explanation fully agrees with the the definition of "&":

"Definition: The address of operator, &, returns the address of a
variable or object.

Example:

int result; // Integer object.
int *pt; //Integer pointer
pt = &result; //Stores the address of result in the pointer, pt."

from http://cplus.about.com/od/cprogrammi..._addofoper.htm

I already wrote this a couple of times, I believe - I feel just like
repeating myself over-and-over.

So: You need to dereference this pointer variable, in order to "access
the value of the pointed-to-value (the pointer in C)."

I can't see that should be so difficult to understand. Now, in C++ you
can pass arguments in a function header "by-reference" by using the
"&"-operator. You can have a function header like this:

return_type some_function( int &reference ) {..... }

and the "&reference" in cpp means: "accept a reference which is just
like an alias for the passed-by-variable".

C doesn't understands references. If it should accept a pointer it would be:

return_type some_function( int *reference ) {..... }

In the C language *THAT SAME THING* (remember my previously
explanations?): "&reference" means: "dont access the variable itself
directly. Instead pass the address of the variable, so it'll become a
pointer-to-variable."

You need to *DEREFERENCE* any pointer-to-variable in order to access the
values of those variables in C.

You *can't* have a construction like this in C:

return_type some_function( int &reference ) {..... }

So don't tell me that there isn't any difference between the 2
languages, like I thought somebody wrote earlier (could be that was just
some kind of "communication error", since I think everyone at least at
some moment agreed to this fact even though they wrote that there isn't
any difference - not easy to understand that)...

I'm not sure if this is a detailed enough explanation, but I really feel
really like I'm repeating myself too much... Still you should understand
it now, right?
Ok. Make your pick and find something in the first sentence that completes
the pattern
_________________ is a reference in C++.
I don't know what you're talking about, and I really don't feel like
playing silly games right now. Why don't you just tell whatever you
think instead of asking me to guess what you think (I can't guess what
you think anyway)?
I cannot find anything mentioned in the first sentence that matches this
requirement. The natural candidate would be the phrase "the pointer in C".
Then we would read:
the pointer in C is a reference in C++.
The pointer in C *dereferenced* corresponds to a reference in C++!
Now that line is odd, because C++ has pointers and those pointers work
exactly the same like pointers in C. So a pointer in C really corresponds
to a pointer in C++ and a reference in C++ simply has no counterpart in C.
The pointer in C *dereferenced* corresponds to a reference in C++!

That's what the whole discussion is all about, remember that?

You remember this talk about "automatic dereferencing"? What do you
think that talk was about? You couldn't have understood that could you?
That is fully consistent with my previous explanation, AFAICS. If you
think I somewhere wrote something wrong, perhaps you can tell me where
this is because I have a very hard time figuring out what you mean...

Still, you need to understand that this "&reference" isn't the variable
itself - it's the *address* of that variable. I don't think you
understood that from my previously explanation, but now I've given an
example above together with a pretty detailed explanation, so I think it
should be possible to understand it now.
Parsed literally, this is not true: "That same thing" is actually the
same in C++: if you try to access the value of the pointed-to-value, you
have to


No. "That same thing" is not the same in C as in C++. In the C++
language it's a reference! "Default user" even agrees with me a bit,
since earlier he wrote that: "There is no pass by reference in C".

Clearly, I did not understand what the phrase "That same thing" was supposed
to refer to.


You should just ask about it then, because you're really confusing me
with your guesses.
dereference the pointer. No difference.


I can't believe you're actually writing that there isn't any difference!

Please, do no exaggerate my claims. Of course the is a difference between C
and C++. And we already agreed on a wording to describe it:


I'm not sure if I exaggerated. You and "default user" both specifically
wrote something about "No difference between the 2 languages", but
instead you ought to express that ofcourse there is a very clear
difference between C and C++.

That would show that you at least understood something relevant in my
explanations...

So I *really* don't understand all of this talk with "no difference".

Like: When there is no difference between passing a pointer, why the
h*** do you then write about it as if it was relevant, when it's
absolutely *irrelevant*?

I just don't understand that... It's just making the discussion
*unnecessary* long and complicated and nobody is interested in that, I hope.
C++ has call by value and call by reference whereas C only has
call by value.

All the fuzz is just about the *additional* explanations that you propose.
It's *really* simple...
I'm writing that there *IS* a very clear difference. I don't think you
read it correctly. We're discussing using the &-operator. And if you
think it works the same way in C as in C++, when you pass a variable
into a function with the &-operator, then you're completely wrong.

Hm, the only difference in how the &-operator *works* in C and C++ is that
you can overload operator&() in C++. The workings of the &-operator are
exactly the same: in both languages, it returns a pointer to the object
specified by its argument.


Irrelevant, I believe.
In particular, *when you pass a variable into a function with the
&-operator*, there is no difference in the C and C++ will handle this
function call (unless operator& was overloaded in C++). The difference
between the two languages is not something that shows *when you pass a
variable into a function with the &-operator*.
Irrelevant, I believe.

I believe that you ought not to bring all of these irrelevant topics
into the discussion, as they're just confusing more than they serve any
reasonable purpose.
Let me point this completely out for you:

1) In C you pass the address of the variable value.
2) In C++ You pass the value by reference.

Incomplete. Instead it should read:

If you want to call a function that modifies an object from the ambient
scope:


That discussion is irrelevant, AFAICS.
1) In C you pass the address of the object.
2) In C++ you do the same, or alternatively, you pass a reference for
the object. Which way you have to go is determined by the signature.
I don't disagree, but my explanation was enough for understanding and
realizing that there is a difference between C and C++, so what you're
writing is simply irrelevant and not something I intend to waste much
time on...
[snip]

And you don't see any difference?

I do. See above. The question is not *whether* there is a difference, but
how to phrase it.


You should try to concentrate on what is relevant here.
OMFG... Not strange that you can't see that in C you would need to
dereference a pointer (containing the address of the variable) while in
C++ it's like having "automatic dereferencing" of a pointer-to-variable,
so to speak - in C-terms...

I do see that. I just don't find that wording particularly helpful.


Somehow I don't think you can see it even though you write it... Are you
sure you can see it, with my last 3 postings with pretty long explanations?
Moreover, this mental model led you to claims like: there is a difference
in how operator& works in C and C++ (besides its capacity for being
Wrong! I still don't understand all of your irrelevant talk about "how
operator& works in C and C++".

That's just irrelevant garbage... Where in my previous posts did you see
I wrote something about operator& ???

You need to cut down all this irrelevant talk... It's just confusing...

I suppose you just don't understand something in the previously
explanations and are making wild guesses... Please stop guessing,
because it's too confusing to read.
overloaded). Such claim is just false and a mental model leading to such
statements is of questionable value.
[snip]

But ofcourse it's no big deal if something was inaccurate written -
you're just fundamentally wrong when you say that there no difference
between passing something to a function in C and C++.

I did not say that. I wrote there is no difference with regard to the
following statement:

In C you would get either a compiler error or warning if you don't
dereference the pointer when you want to access the value of the
pointed-to-value (the pointer in C).


I really don't understand you... Sometimes you write that there isn't
any difference between the 2 languages. Like with the above statement.

But I clearly pointed out the difference I believe... And yet you don't
think there's a difference?
I do not think that one should explain a language *difference* using
sentences about C that just literally stay true when you replace C with
C++.


I dont understand one word of that. I never wanted to replace C with C++
(or was it the other way around?). You are the only one who talks about
replacing C and C++...

As I wrote earlier: You really need to cut down this irrelevant talk,
because some of it is really confusing...
Best regards / Med venlig hilsen
Martin Jørgensen

--
---------------------------------------------------------------------------
Home of Martin Jørgensen - http://www.martinjoergensen.dk
Apr 21 '06 #34
Martin Jørgensen wrote:

I'm not sure if I exaggerated. You and "default user" both
specifically wrote something about "No difference between the 2
languages", but instead you ought to express that ofcourse there is a
very clear difference between C and C++.


Please quote where I said that. I didn't. I said there was no
difference in the way pointers work between the two. Please STOP
claiming I said things I didn't. I clearly stated that, of course, C
doesn't have references AT ALL.

As I said, you need to get it out of your head that pointers and
references are in any way linked. They aren't, other than in a loosely
conceptual way (and probably in the implementation, but that's not of
interest).

Aliasing is the better conceptual model for references, that gets you
away from this, "in C if you don't dereference the pointer it's an
error" business. It has nothing to do with anything. References are not
pointers, pointers are not references.


Brian
Apr 21 '06 #35
Martin Jørgensen <un*********@spam.jay.net> wrote:
"Definition: The address of operator, &, returns the address of a
variable or object. Now, in C++ you
can pass arguments in a function header "by-reference" by using the
"&"-operator. You can have a function header like this:
No. This is not the address-of operator. Just like the '&' below is
not the address-of operator either.

int a = 1;
int b = 1;

if (a &b) {}

So it depends on the context, what a character means.
and the "&reference" in cpp means: "accept a reference which is just
like an alias for the passed-by-variable".

C doesn't understands references. If it should accept a pointer it
would be:
return_type some_function( int *reference ) {..... }

In the C language *THAT SAME THING* (remember my previously
explanations?): "&reference" means: "dont access the variable itself
directly. Instead pass the address of the variable, so it'll become a
pointer-to-variable."
I think there is a misconception about what the characters
'&reference' mean:

When you just say '&var', where 'var' is an _existing_ variable, you
will always[*] (in C and in C++) get the address of that variable.
There, the '&' is the address-of operator applied to a variable.

When you say 'int &var', '&' is _not_ the address-of operator
anymore. It is part of the type, which is why I would have written 'int&
var' in the first place. The '&' in this context means something
completely different, because you are using a different concept. It is
_not_ the address of anything.

I'll just go into how _I_ see references. Maybe this helps you
understand the views of 'Default User' and Kai-Uwe.

Reference means you want another name for an object. References are
not addresses. They are a different concept:

int i = 0;
int j = 0;
int& k = i;

It is clear that 'i' does not have anything to do with an address.
'i' is just a name for a sequence of bytes in memory. 'j' is also a name
of a sequence of bytes in memory, but for a different one. Now, 'k' is a
_different_name_ for the _same_sequence_ of bytes in memory, that 'i' is
a name for.
[*] Let's keep overloaded operators out of this .. simplifies my
wording :)
[..] "&reference" isn't the
variable itself - it's the *address* of that variable.


See above.

regards
--
jb

(reply address in rot13, unscramble first)
Apr 22 '06 #36
Kuku posted:
What is the difference between a reference and a pointer?

The thing you have to understand is that there's a lot of "magic" in C++.
There's lots of stuff in C++ that just gets done for you! Examples:

1) Virtual Functions

As many of us know, compilers implement virtual functions by using pointers
to V-Tables which they "hide" at the beginning of the object in question.
However, as a C++ programmer, we don't need to know anything about this, we
just need to understand its behaviour! Furthermore, the C++ Standard leaves
it up to the compiler to implement this feature in WHATEVER WAY IT PLEASES.
The compiler isn't obligated to use V-Tables, and concordantly, if your code
contains "hacks" which plays with a V-Table, it isn't guaranteed to work on
every platform and implementation.

2) References

Again, it's irrelevant how the compiler actually implements references --
all you need to understand is their behaviour, which can be split into three
categories:

2.a) Simple statements like as follows:

int k;

int &r = k;

r = 7;

In this example, the compiler will just treat "r" as if you had written "k".

2.b) Passing function arguments by reference:

The idea here is that you're actually changing the object in the calling
function. This seems to be where most of you have a problem. All you need to
understand and know is the behaviour of this facility. In the background,
the compiler may very well be passing around the address of an object (it
may also be teaching elephants how to drive if it wants), but none of this
concerns you as the programmer. Just come to terms with its behaviour.

2.c) Returning a reference:

std::string& str = ReturnStringByRef();

str += "monkey";
In this example, all you need to know is that when you change str, you're
actually working with the object which was returned by reference from
"ReturnStringByRef". The object in question may be a global variable, or it
may be a static variable in "ReturnStringByRef", or it may have be
dynamically allocated. It's very possible (likely, even) that a compiler
achieves this behaviour by passing around an object's address, but that's
irrelevant to you as the programmer.

Some people don't like magic in computer programming languages. For those of
you here that regularly program in C++, have you ever had a look through a C
program and realised just how "manual" it is! Nothing is done magically!

If you don't like magic, you can still use C++, but just don't use any of
the modern features -- you can stick to the techniques you used in C. I can
assure you however, that you will come to see the great merit in all the
magic there is in C++. It's much handier to type the keyword "virtual", than
to have to go create, design and implement a V-Table.

Moral of the story is this: Get to know references. Get to know how they
work. Analyse every aspect of their behaviour. When you become accustomed to
exactly how they work (and accept that magic is happening in places), then
you won't bother asking questions, because you realise that the compiler is
free to achieve things in any way it pleases.

Notwithstanding this though, there are people in this world who refuse to
just "skim the surface", (I'd classify myself as one of these), and who
demand to understand exactly what's going on. In order to satisfy my hunger,
I went about writing a C++ program which had all sorts of features which
were magic, and then tried to rewrite the program in C. For virtual
functions, I wrote my own V-Tables. For pass-by-reference, I passed
pointers. For return-by-reference, I returned pointers.
If you really want to understand what goes on under the hood, you may
appreciate undertaking such a pet project -- it will greatly enhance your
understanding of C++.

But when you're in Rome, do as the Romans do; and when you're programming in
C++, exploit all the magic that comes your way. So pass object's by
reference if you want to alter them! Use pointers when you actually want to
mess with memory addresses (like iterating through the characters of a
string).

-Tomás
Apr 22 '06 #37
Default User wrote:
Martin Jørgensen wrote: -snip-
As I said, you need to get it out of your head that pointers and
references are in any way linked. They aren't, other than in a loosely
I DIDN'T WRITE THEY WERE LINKED... Okay?
conceptual way (and probably in the implementation, but that's not of
interest).

Aliasing is the better conceptual model for references, that gets you
away from this, "in C if you don't dereference the pointer it's an
error" business. It has nothing to do with anything. References are not
pointers, pointers are not references.


I DIDN'T WRITE THAT! Okay?

You're about to enter my kill-filter if you don't stop claiming I wrote
that references = pointers.
Best regards / Med venlig hilsen
Martin Jørgensen

--
---------------------------------------------------------------------------
Home of Martin Jørgensen - http://www.martinjoergensen.dk
Apr 22 '06 #38
Jakob Bieling wrote:
Martin Jørgensen <un*********@spam.jay.net> wrote:

"Definition: The address of operator, &, returns the address of a
variable or object.
Now, in C++ you
can pass arguments in a function header "by-reference" by using the
"&"-operator. You can have a function header like this:

No. This is not the address-of operator. Just like the '&' below is
not the address-of operator either.


When you write: "No. This is not the address-of operator....
bla.bla.bla", then that's completely ridiciculous because I even
distinguished clearly between that myself in my previous explanation.
int a = 1;
int b = 1;

if (a &b) {}

So it depends on the context, what a character means.

and the "&reference" in cpp means: "accept a reference which is just
like an alias for the passed-by-variable".

C doesn't understands references. If it should accept a pointer it
would be:
return_type some_function( int *reference ) {..... }

In the C language *THAT SAME THING* (remember my previously
explanations?): "&reference" means: "dont access the variable itself
directly. Instead pass the address of the variable, so it'll become a
pointer-to-variable."

I think there is a misconception about what the characters
'&reference' mean:

When you just say '&var', where 'var' is an _existing_ variable, you
will always[*] (in C and in C++) get the address of that variable.


OMFG! That's what I wrote...
There, the '&' is the address-of operator applied to a variable.
Please stop repeating what I write, if you don't have anything relevant
to disagree with...
When you say 'int &var', '&' is _not_ the address-of operator
anymore. It is part of the type, which is why I would have written 'int&
OMFG! That's exactly what I wrote!
var' in the first place. The '&' in this context means something
completely different, because you are using a different concept. It is
_not_ the address of anything.
IT IS IN C! Notice how I *very clearly* distinguish between the two
languages, goddamnit... You're making something up, which I never even
wrote.
I'll just go into how _I_ see references. Maybe this helps you
understand the views of 'Default User' and Kai-Uwe.
I think they understand... They should after all these long
explanations. And you should too.
Reference means you want another name for an object. References are
not addresses. They are a different concept:
That exactly corresponds to what I wrote. So what's your point? Why the
hell are you just repeating my explanation, in your own words?
int i = 0;
int j = 0;
int& k = i;

It is clear that 'i' does not have anything to do with an address.
I never wrote that!
'i' is just a name for a sequence of bytes in memory. 'j' is also a name
of a sequence of bytes in memory, but for a different one. Now, 'k' is a
_different_name_ for the _same_sequence_ of bytes in memory, that 'i' is
a name for.
That exactly corresponds to what I wrote. So what's your point? Why the
hell are you just repeating my explanation, in your own words?
[*] Let's keep overloaded operators out of this .. simplifies my
wording :)


Let me be very clear here: There's *absolutely* no reason to discuss
overloaded operators here.
[..] "&reference" isn't the
variable itself - it's the *address* of that variable.

See above.


What I don't understand is why the h** you seem to disagree with me and
yet you're just repeating my whole explanation in your own words?

If I should cut everything down of what you wrote, then you completely
agree with me because it's just garbage you're writing about in this post...

There's absolutely nothing of your criticism that I regognize... Your
whole post is ridiculous...
Best regards / Med venlig hilsen
Martin Jørgensen

--
---------------------------------------------------------------------------
Home of Martin Jørgensen - http://www.martinjoergensen.dk
Apr 22 '06 #39
Martin Jørgensen wrote:
I DIDN'T WRITE THEY WERE LINKED... Okay?


Have you stopped beating your wife, Martin?

;-)

--
Phlip
http://www.greencheese.org/ZeekLand <-- NOT a blog!!!
Apr 22 '06 #40
Martin Jørgensen <un*********@spam.jay.net> wrote:

First off, please calm down. I am not trying to pick on you. I
explained my mental model of references to you, because you obviously
have trouble coping with yours (quote: "this automatic dereferencing
when you pass by reference I find most confusing"). If you do not want
to accept this way of thinking of references, it is fine with me. I do
not get paid for convincing you.
Jakob Bieling wrote:
Martin Jørgensen <un*********@spam.jay.net> wrote:
"Definition: The address of operator, &, returns the address of a
variable or object. Now, in C++ you
can pass arguments in a function header "by-reference" by using the
"&"-operator. You can have a function header like this: return_type some_function( int &reference ) {..... }
(Sorry, I snipped the above line in my previous reply)
No. This is not the address-of operator. Just like the '&' below
is not the address-of operator either. When you write: "No. This is not the address-of operator....
bla.bla.bla", then that's completely ridiciculous because I even
distinguished clearly between that myself in my previous explanation.
No you did not. See above. There you said "[..] pass arguments [..]
'by-reference' by using the '&'-operator" (which by itself is not right)
and the following example 'int& reference' just was not an address-of
operator.
When you say 'int &var', '&' is _not_ the address-of operator
anymore. It is part of the type, which is why I would have written
'int& var' in the first place. The '&' in this context means
something
completely different, because you are using a different concept. It
is _not_ the address of anything. IT IS IN C!
It is not, because it simply will not compile. Talking about
contexts.

int i = 0;
int& j = i; // _not_ C!
Reference means you want another name for an object. References
are not addresses. They are a different concept: That exactly corresponds to what I wrote. So what's your point? Why
the hell are you just repeating my explanation, in your own words?
My point is just to completely lay out my mental model of references
to you, without leaving out details just because someone has said them
before.
int i = 0;
int j = 0;
int& k = i; It is clear that 'i' does not have anything to do with an
address. I never wrote that!
Of course, you did not. But I did.
'i' is just a name for a sequence of bytes in memory. 'j' is also a
name of a sequence of bytes in memory, but for a different one. Now,
'k' is a _different_name_ for the _same_sequence_ of bytes in
memory, that 'i' is a name for. That exactly corresponds to what I wrote. So what's your point? Why
the hell are you just repeating my explanation, in your own words? [*] Let's keep overloaded operators out of this .. simplifies my
wording :)
Let me be very clear here: There's *absolutely* no reason to discuss
overloaded operators here.
Please read what I wrote: "Let's keep overloaded operators out of
this" .. so I obviously did not have the intention to discuss them, but
rather included this little footnote for completeness to avoid replies
in that direction beforehand.
[..] "&reference" isn't the
variable itself - it's the *address* of that variable.

See above.

What I don't understand is why the h** you seem to disagree with me
and yet you're just repeating my whole explanation in your own words?
Maybe because your wording is misleading. It is confusing that you
write in one post, 'int& r' uses the address-of operator. When I tell
you that this is not true, you claim to have known that, telling me my
answer was ridiculous. If you knew that, then I apologize. On the other
hand, you should probably re-read your own postings before you send them
and make sure you are not misusing terminology and thus creating
confusion in the first place.
If I should cut everything down of what you wrote, then you completely
agree with me because it's just garbage you're writing about in this
post...


Not quite. Maybe you did not read my post carefully enough. The
mental model of references I presented does not suffer any confusing
auto-dereferencing, while yours does. If you do not like this model, I
honestly do not care. I do not gain anything, but even was I investing
my time to try to help you. If you do not want that, just say so and
save your time and mine.

hth
--
jb

(reply address in rot13, unscramble first)
Apr 22 '06 #41
Martin Jørgensen wrote:

You're about to enter my kill-filter if you don't stop claiming I
wrote that references = pointers.


Frankly, that's not much of a threat. At any rate, I think we've
muddied up the water past any useful discussion at this point. You're
obviously getting agitated, and that will likely just result in an
increasingly acrimonious thread, so I'll leave it where it is.

I'll take your word for it that you understand the difference.


Brian
Apr 22 '06 #42
Jakob Bieling wrote:
Martin Jørgensen wrote:

First off, please calm down. I am not trying to pick on you. I
explained my mental model of references to you, because you obviously have
trouble coping with yours (quote: "this automatic dereferencing when you
pass by reference I find most confusing"). If you do not want to accept
this way of thinking of references, it is fine with me. I do not get paid
for convincing you.


Ben: You can use Einsteinean physics to prove Newtonian physics...

Ken (a physicist wannabe): You certainly can NOT!!

Me: What Ben meant is that you can use Einsteinean physics to
demonstrate why Newton thought that Newtonian physics
would work.

One extremely convient way to explain references to folks familiar with
pointers is to say "It's like a pointer with the indirection already turned
on".

This simile is completely harmless, except when exposed to language lawyer
wannabes.

(And I'm probably not helping the situation;)

--
Phlip
http://www.greencheese.org/ZeekLand <-- NOT a blog!!!
Apr 23 '06 #43
Phlip wrote:
Martin Jørgensen wrote:

I DIDN'T WRITE THEY WERE LINKED... Okay?

Have you stopped beating your wife, Martin?

;-)


I'm pretty tired of telling people how to use their brain...

Next thing is that I bet I should also tell them to remember to breathe
and eat...
Best regards / Med venlig hilsen
Martin Jørgensen

--
---------------------------------------------------------------------------
Home of Martin Jørgensen - http://www.martinjoergensen.dk
Apr 23 '06 #44
Phlip wrote:
Jakob Bieling wrote: -snip-
Ben: You can use Einsteinean physics to prove Newtonian physics...

Ken (a physicist wannabe): You certainly can NOT!!

Me: What Ben meant is that you can use Einsteinean physics to
demonstrate why Newton thought that Newtonian physics
would work.

One extremely convient way to explain references to folks familiar with
pointers is to say "It's like a pointer with the indirection already turned
on".

This simile is completely harmless, except when exposed to language lawyer
wannabes.

(And I'm probably not helping the situation;)


Yes, you are helping the situation... It's basically really as simple as
that!

I can't believe people keep asking me crazy things about how to
understand this and how to understand that... I'm not their father,
raising a little child who was to learn everything from the beginning
and I'm pretty tired of spending my time telling people "how to
understand this and that"...
Best regards / Med venlig hilsen
Martin Jørgensen

--
---------------------------------------------------------------------------
Home of Martin Jørgensen - http://www.martinjoergensen.dk
Apr 23 '06 #45
Jakob Bieling wrote:
Martin Jørgensen <un*********@spam.jay.net> wrote:

First off, please calm down. I am not trying to pick on you. I
You're trying to waste as much of my time as possible.
explained my mental model of references to you, because you obviously
have trouble coping with yours (quote: "this automatic dereferencing
I don't care about your mental model! I never asked for your mental
model! I posted my reply so the OP could see and understand what I found
most difficult going from C to C++ and learning what's a reference and
how does it work.
when you pass by reference I find most confusing"). If you do not want
to accept this way of thinking of references, it is fine with me. I do
not get paid for convincing you.
I don't care about your mental model! I never asked for your mental
model! If I had asked for it I would write: "Please tell me this and
please tell me that" - my postings was originally for the OP who started
this thread and who was obviously confused about references and
pointers. So I contributed by telling him my own background and how it
was for me going from C to C++.
Jakob Bieling wrote:


Martin Jørgensen <un*********@spam.jay.net> wrote:
"Definition: The address of operator, &, returns the address of a
variable or object.
Now, in C++ you
can pass arguments in a function header "by-reference" by using the
"&"-operator. You can have a function header like this:
return_type some_function( int &reference ) {..... }

(Sorry, I snipped the above line in my previous reply)

No. This is not the address-of operator. Just like the '&' below
is not the address-of operator either.
When you write: "No. This is not the address-of operator....
bla.bla.bla", then that's completely ridiciculous because I even
distinguished clearly between that myself in my previous explanation.

No you did not. See above. There you said "[..] pass arguments [..]
'by-reference' by using the '&'-operator" (which by itself is not right)
and the following example 'int& reference' just was not an address-of
operator.


I never wrote that the & in "int& reference" meant the
address-of-operator! Still you need "&" in the function header to use
pass-by-reference, you complete moron and that's what I wrote about!

Do I have to tell you how to breathe and when to breathe? Do I have to
tell you when to get to school or work? Do I have to tell you what to
think about in every goddamn possible way about every goddamn small tiny
thing, like when to raise your hand to do such really simple things as
eating or drinking, which normal people can understand themselves?
When you say 'int &var', '&' is _not_ the address-of operator
anymore. It is part of the type, which is why I would have written
'int& var' in the first place. The '&' in this context means
something
completely different, because you are using a different concept. It
is _not_ the address of anything.
IT IS IN C!

It is not, because it simply will not compile. Talking about
contexts.

int i = 0;
int& j = i; // _not_ C!


You fucking idiot! If you don't want to read what I'm writing then
please fuck off. Did I ever write that in C you could write?:

int i = 0;
int& j = i; // _not_ C!

I DID NOT! You stupid idiot... I also gave some pretty detailed
explanations which are impossible not to understand for people who wants
to understand them - It is *VERY* clear that you don't even *WANT* to
understand what I wrote and there's simply no cure for that.
Reference means you want another name for an object. References
are not addresses. They are a different concept:
That exactly corresponds to what I wrote. So what's your point? Why
the hell are you just repeating my explanation, in your own words?

My point is just to completely lay out my mental model of references
to you, without leaving out details just because someone has said them
before.


Again: Please fuck off with your mental model and all of your bullshit...
int i = 0;
int j = 0;
int& k = i;
It is clear that 'i' does not have anything to do with an
address.
I never wrote that!

Of course, you did not. But I did.


You fucking idiot... Cut down all the bullshit and there's pretty much
nothing left in your posting.
'i' is just a name for a sequence of bytes in memory. 'j' is also a
name of a sequence of bytes in memory, but for a different one. Now,
'k' is a _different_name_ for the _same_sequence_ of bytes in
memory, that 'i' is a name for.
That exactly corresponds to what I wrote. So what's your point? Why
the hell are you just repeating my explanation, in your own words?


[*] Let's keep overloaded operators out of this .. simplifies my
wording :)

Let me be very clear here: There's *absolutely* no reason to discuss
overloaded operators here.

Please read what I wrote: "Let's keep overloaded operators out of
this" .. so I obviously did not have the intention to discuss them, but
rather included this little footnote for completeness to avoid replies
in that direction beforehand.


You stupid idiot... I take it that you didn't even read the previous
discussion because some other guy also wrote something about discussing
overloaded operators and I also stated exactly the same point as you've
just repeated several times here...

That fact just proves that you don't even want to read what the
discussion is all about (if you've read a few postings back, you would
have known about this).

It's now very clear to me that you don't even care about understanding
this whole discussion, unfortunately. And it looks pretty much to me
like you never intended that.
[..] "&reference" isn't the
variable itself - it's the *address* of that variable.
See above.
What I don't understand is why the h** you seem to disagree with me
and yet you're just repeating my whole explanation in your own words?

Maybe because your wording is misleading. It is confusing that you
write in one post, 'int& r' uses the address-of operator. When I tell


You need a brain to understand what I'm writing and understand the
difference between having the & in the function header and everywhere
else in the program.

So my advice to you is: Go ahead and buy yourself a brain - then you can
come back and discuss the address-of-operator if you want (at that time).
you that this is not true, you claim to have known that, telling me my
answer was ridiculous. If you knew that, then I apologize. On the other
You're a complete moron and your answer *IS* ridiculous...
hand, you should probably re-read your own postings before you send them
and make sure you are not misusing terminology and thus creating
confusion in the first place.
Well, what can I say: You don't want to read anything of what I write,
so here's a fair deal:

Then I don't want to read any of your bullshit - so welcome to my kill
filter...

I would say: That's a pretty fair deal...
If I should cut everything down of what you wrote, then you completely
agree with me because it's just garbage you're writing about in this
post...

Not quite. Maybe you did not read my post carefully enough. The
mental model of references I presented does not suffer any confusing
auto-dereferencing, while yours does. If you do not like this model, I


You complete idiot... Since you don't understand the mental model about
"auto-dereferencing" then ofcourse it's confusing for you because it
seems like you have a lot of trouble reading english explanations which
ofcourse also requires that you know some basics about programming.
honestly do not care. I do not gain anything, but even was I investing
my time to try to help you. If you do not want that, just say so and
save your time and mine.


I can see you only posted 2 replies here and both are complete full of
shit to a degree which I find so annoying that you're now in my kill-filter.

You didn't even care to read just a few previous postings to understand
what this discussion is about, before you posted all of your bullshit.

And with your attitude which is "trying to explain me" something, when
it in fact is you that needs to read some of the previous postings: Fuck
off...

EOD... You won't get another reply from me - you already wasted too much
of my time on ridiculous bullshit and I believe no ordinary thinking
person who read the previous (perhaps about 10, maybe 12-14) postings
doesn't know what the discussion is about.
Best regards / Med venlig hilsen
Martin Jørgensen

--
---------------------------------------------------------------------------
Home of Martin Jørgensen - http://www.martinjoergensen.dk
Apr 23 '06 #46
Martin Jørgensen <un*********@spam.jay.net> wrote:
Jakob Bieling wrote:
Martin Jørgensen <un*********@spam.jay.net> wrote:

First off, please calm down. I am not trying to pick on you. I
You're trying to waste as much of my time as possible.
explained my mental model of references to you, because you obviously
have trouble coping with yours (quote: "this automatic dereferencing


I don't care about your mental model! I never asked for your mental
model! I posted my reply so the OP could see and understand what I
found most difficult going from C to C++ and learning what's a
reference and how does it work.


Did he ask you to tell him what you found difficult? No. Was your
reply inappropriate? No.

Did you ask about my mental model? No. Was my reply inappropriate?
No.

You see, when you say that you have trouble with something, people
in the news group tell you their experiences. That is how news groups
work. If you cannot cope with this, do not come here.
when you pass by reference I find most confusing"). If you do not
want to accept this way of thinking of references, it is fine with
me. I do not get paid for convincing you.


I don't care about your mental model! I never asked for your mental
model! If I had asked for it I would write: "Please tell me this and
please tell me that" - my postings was originally for the OP who
started this thread and who was obviously confused about references
and pointers. So I contributed by telling him my own background and
how it
was for me going from C to C++.


See above.
Jakob Bieling wrote: Martin Jørgensen <un*********@spam.jay.net> wrote: "Definition: The address of operator, &, returns the address of a
> variable or object. Now, in C++ you
> can pass arguments in a function header "by-reference" by using
> the "&"-operator. You can have a function header like this: return_type some_function( int &reference ) {..... } No. This is not the address-of operator. Just like the '&' below
is not the address-of operator either. When you write: "No. This is not the address-of operator....
bla.bla.bla", then that's completely ridiciculous because I even
distinguished clearly between that myself in my previous
explanation.
No you did not. See above. There you said "[..] pass arguments
[..] 'by-reference' by using the '&'-operator" (which by itself is
not right) and the following example 'int& reference' just was not
an address-of operator.


I never wrote that the & in "int& reference" meant the
address-of-operator! Still you need "&" in the function header to use
pass-by-reference, you complete moron and that's what I wrote about!


You called it '&'-operator (see the quote above). It is not an
operator. That was the whole point.
Do I have to tell you how to breathe and when to breathe? Do I have to
tell you when to get to school or work? Do I have to tell you what to
think about in every goddamn possible way about every goddamn small
tiny thing, like when to raise your hand to do such really simple
things as eating or drinking, which normal people can understand
themselves?
?!
When you say 'int &var', '&' is _not_ the address-of operator
anymore. It is part of the type, which is why I would have written
'int& var' in the first place. The '&' in this context means
something
completely different, because you are using a different concept. It
is _not_ the address of anything. IT IS IN C!
It is not, because it simply will not compile. Talking about
contexts.

int i = 0;
int& j = i; // _not_ C!


You fucking idiot! If you don't want to read what I'm writing then
please fuck off. Did I ever write that in C you could write?:

int i = 0;
int& j = i; // _not_ C!

I DID NOT! You stupid idiot... I also gave some pretty detailed
explanations which are impossible not to understand for people who
wants to understand them - It is *VERY* clear that you don't even
*WANT* to
understand what I wrote and there's simply no cure for that.


If you are not willing to keep the discussion at an acceptable
niveau, I am not willing to discuss with you any further.

I know what you wrote and what I wrote. What I wrote was to
illustrate my point, which you have in rage obviously missed by far.
Reference means you want another name for an object. References
are not addresses. They are a different concept:


That exactly corresponds to what I wrote. So what's your point? Why
the hell are you just repeating my explanation, in your own words?

My point is just to completely lay out my mental model of
references to you, without leaving out details just because someone
has said them before.


Again: Please fuck off with your mental model and all of your
bullshit...

int i = 0;
int j = 0;
int& k = i; It is clear that 'i' does not have anything to do with an
address. I never wrote that!
Of course, you did not. But I did. You fucking idiot... Cut down all the bullshit and there's pretty much
nothing left in your posting.
If all you have to add is cursing, please do not add anything at
all.
'i' is just a name for a sequence of bytes in memory. 'j' is also a
name of a sequence of bytes in memory, but for a different one.
Now, 'k' is a _different_name_ for the _same_sequence_ of bytes in
memory, that 'i' is a name for.


That exactly corresponds to what I wrote. So what's your point? Why
the hell are you just repeating my explanation, in your own words?


[*] Let's keep overloaded operators out of this .. simplifies my
wording :)

Let me be very clear here: There's *absolutely* no reason to discuss
overloaded operators here.

Please read what I wrote: "Let's keep overloaded operators out of
this" .. so I obviously did not have the intention to discuss them,
but rather included this little footnote for completeness to avoid
replies in that direction beforehand.


You stupid idiot... I take it that you didn't even read the previous
discussion because some other guy also wrote something about
discussing overloaded operators and I also stated exactly the same
point as you've just repeated several times here...

That fact just proves that you don't even want to read what the
discussion is all about (if you've read a few postings back, you would
have known about this). It's now very clear to me that you don't even care about understanding
this whole discussion, unfortunately. And it looks pretty much to me
like you never intended that.


I read it all. Why does it bother you so much that I have just
excluded this topic once again, for those not having read it everything?
> [..] "&reference" isn't the
> variable itself - it's the *address* of that variable.


See above.


What I don't understand is why the h** you seem to disagree with me
and yet you're just repeating my whole explanation in your own
words?

Maybe because your wording is misleading. It is confusing that
you write in one post, 'int& r' uses the address-of operator. When I
tell


You need a brain to understand what I'm writing and understand the
difference between having the & in the function header and everywhere
else in the program.

So my advice to you is: Go ahead and buy yourself a brain - then you
can come back and discuss the address-of-operator if you want (at
that time).
you that this is not true, you claim to have known that, telling me
my answer was ridiculous. If you knew that, then I apologize. On the
other


You're a complete moron and your answer *IS* ridiculous...
hand, you should probably re-read your own postings before you send
them and make sure you are not misusing terminology and thus creating
confusion in the first place.


Well, what can I say: You don't want to read anything of what I write,
so here's a fair deal:

Then I don't want to read any of your bullshit - so welcome to my kill
filter...

I would say: That's a pretty fair deal...
If I should cut everything down of what you wrote, then you
completely agree with me because it's just garbage you're writing
about in this post...

Not quite. Maybe you did not read my post carefully enough. The
mental model of references I presented does not suffer any confusing
auto-dereferencing, while yours does. If you do not like this model,
I


You complete idiot... Since you don't understand the mental model
about "auto-dereferencing" then ofcourse it's confusing for you
because it seems like you have a lot of trouble reading english
explanations
which ofcourse also requires that you know some basics about
programming.


Yes, I will probably have a problem with that mental model. This is
why I do not use it. And you obviously have the same problem with it,
which is why I was trying to help.
honestly do not care. I do not gain anything, but even was I
investing my time to try to help you. If you do not want that, just
say so and save your time and mine.


I can see you only posted 2 replies here and both are complete full of
shit to a degree which I find so annoying that you're now in my
kill-filter.
You didn't even care to read just a few previous postings to
understand what this discussion is about, before you posted all of
your bullshit.
And with your attitude which is "trying to explain me" something, when
it in fact is you that needs to read some of the previous postings:
Fuck off...

EOD... You won't get another reply from me - you already wasted too
much of my time on ridiculous bullshit and I believe no ordinary
thinking
person who read the previous (perhaps about 10, maybe 12-14) postings
doesn't know what the discussion is about.


Do everyone a favor and try to be more calm in the next discussion
you take part in. And please consider accepting criticism about your use
of terminology. Maybe you should just look up what the '&'-operator is,
and what it is not.
--
jb

(reply address in rot13, unscramble first)
Apr 23 '06 #47
Martin Jørgensen wrote:

And with your attitude which is "trying to explain me" something,
when it in fact is you that needs to read some of the previous
postings: Fuck off...

EOD... You won't get another reply from me - you already wasted too
much of my time on ridiculous bullshit and I believe no ordinary
thinking person who read the previous (perhaps about 10, maybe 12-14)
postings doesn't know what the discussion is about.


Your behavior is unacceptable.

*plonk*
Brian

Apr 23 '06 #48
Default User wrote:
Martin Jørgensen wrote:
And with your attitude which is "trying to explain me" something,
when it in fact is you that needs to read some of the previous
postings: Fuck off...

EOD... You won't get another reply from me - you already wasted too
much of my time on ridiculous bullshit and I believe no ordinary
thinking person who read the previous (perhaps about 10, maybe 12-14)
postings doesn't know what the discussion is about.

Your behavior is unacceptable.

*plonk*
Brian


That would probably mean I don't have to waste more time on you. So
thank you very much for that.

I have more important things to spend my time on than this so I really
don't care what you think.
Best regards / Med venlig hilsen
Martin Jørgensen

--
---------------------------------------------------------------------------
Home of Martin Jørgensen - http://www.martinjoergensen.dk
Apr 23 '06 #49
>eference means you want another name for an object. References are
not addresses. They are a different concept:


I dare say that Martin doesn't have problem understanding what the
concepts mean and what the differences are, but rather wording the
idea, that you can *emulate* refefence-like behaviour with pointers in
C, in a way that would satisfy your tastes.

What gets to me, is that this wording problem is turned into "proof"
that someone does not understand what he is talking about. I
understood, or would be so inclined atleast, that I understood
immediately what he meant. But then again, I didn't approach this
thread with nitpicking on my mind foremost.

Ofcourse it is great to straighten out incorrect statements and so on,
but is it really a sign of intelligence to to always for the sake of
argument to think the worst, not the best, of the people you are
debating with begs to be asked.

Who here, honestly, thinks that points and references are too difficult
a concept to give much problem understanding for a 15 year old, not to
mention adult which I'm pretty positive everyone participating seem to
be?

Just a thought. Now ofcourse, it's obvious that I don't know the
difference, right? :)

Apr 24 '06 #50

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

110
by: Mr A | last post by:
Hi! I've been thinking about passing parameteras using references instead of pointers in order to emphasize that the parameter must be an object. Exemple: void func(Objec& object); //object...
9
by: Sandy | last post by:
Hi, In one of my interview I was asked a question, whether using pointers for argument is efficient then reference or not. i.e. void fun(Complex *p) void fun(Complex &ref) can somebody...
18
by: man | last post by:
can any one please tell me what is the diff between pointer and reference.....and which one is better to use ....and why???????
12
by: Mike | last post by:
Consider the following code: """ struct person { char *name; int age; }; typedef struct person* StructType;
13
by: al.cpwn | last post by:
I get that these two are different int* get() { static int m; return &m; } int& get() {
8
by: toton | last post by:
HI, One more small doubt from today's mail. I have certain function which returns a pointer (sometimes a const pointer from a const member function). And certain member function needs reference...
11
by: asdf | last post by:
C++ allows a reference to a pointer, but doesn't allow a pointer to a reference, why?
29
by: shuisheng | last post by:
Dear All, The problem of choosing pointer or reference is always confusing me. Would you please give me some suggestion on it. I appreciate your kind help. For example, I'd like to convert a...
41
by: Summercool | last post by:
Can we confirm the following? also someone said, Java also has "reference" like in C++, which is an "implicit pointer": Pointer and Reference --------------------- I am starting to see what...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.