By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,089 Members | 2,191 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,089 IT Pros & Developers. It's quick & easy.

Dangling pointer quiz question

P: n/a
Hello everybody

in a quiz I had a question about dangling pointer:
"What a dangling pointer is and the danger of using it"

My answer was:
"dangling pointer is a pointer that points to some area of ram that's
not reserved by the program. Accessing memory through such pointer is
likely to result in core dump (memory access violation)"

This was one of the two questions in a 10-min quiz (I was 5 mins late
for this quiz :)

This question is marked based on 3, I got 2 for this question and
correction was that dangling prt is pointer that "..points to invalid
memory". Is this reasonable to ask for 3/3 for my answer?

I got 2/7 for the second question, but I'll fix that problem - there
I'm 100% sure it must be 7/7 ...

Oct 15 '05 #1
Share this Question
Share on Google+
20 Replies


P: n/a
In article <11**********************@g14g2000cwa.googlegroups .com>,
__PPS__ <i-*********@yandex.ru> wrote:
in a quiz I had a question about dangling pointer:
"What a dangling pointer is and the danger of using it"

My answer was:
"dangling pointer is a pointer that points to some area of ram that's
not reserved by the program. Accessing memory through such pointer is
likely to result in core dump (memory access violation)"

This was one of the two questions in a 10-min quiz (I was 5 mins late
for this quiz :)

This question is marked based on 3, I got 2 for this question and
correction was that dangling prt is pointer that "..points to invalid
memory". Is this reasonable to ask for 3/3 for my answer?


First, it's worth pointing(!) out that this is not any sort
of official Standard C++ term. That said, you're answer only
laid out one type of invalid memory, but it could include even
memory that is in the program, etc. So, if you got 2/3, be happy.
--
Greg Comeau / Celebrating 20 years of Comeauity!
Comeau C/C++ ONLINE ==> http://www.comeaucomputing.com/tryitout
World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
Oct 15 '05 #2

P: n/a
In article <di**********@panix2.panix.com>,
Greg Comeau <co****@comeaucomputing.com> wrote:
In article <11**********************@g14g2000cwa.googlegroups .com>,
__PPS__ <i-*********@yandex.ru> wrote:
in a quiz I had a question about dangling pointer:
"What a dangling pointer is and the danger of using it"

My answer was:
"dangling pointer is a pointer that points to some area of ram that's
not reserved by the program. Accessing memory through such pointer is
likely to result in core dump (memory access violation)"

This was one of the two questions in a 10-min quiz (I was 5 mins late
for this quiz :)

This question is marked based on 3, I got 2 for this question and
correction was that dangling prt is pointer that "..points to invalid
memory". Is this reasonable to ask for 3/3 for my answer?


First, it's worth pointing(!) out that this is not any sort
of official Standard C++ term. That said, you're answer only
laid out one type of invalid memory, but it could include even
memory that is in the program, etc. So, if you got 2/3, be happy.


BTW, normally for a pointer to dangle, it normally would have
previously pointed to valid memory. Note that valid memory is
not only memory that the program has valid access to but also
that the pointer previously had valid access to. For instance,
the return value of new, or malloc, but which was then delete'd,
or freed(). And hence the pointer is said to "dangle", since it
need not be reset to something valid, or purposely invalid (like
the null pointer). It seems to have muddled over the years to
include "any invalid pointer", even ones not dangling.
--
Greg Comeau / Celebrating 20 years of Comeauity!
Comeau C/C++ ONLINE ==> http://www.comeaucomputing.com/tryitout
World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
Oct 15 '05 #3

P: n/a
* Greg Comeau:

need not be reset to something valid, or purposely invalid (like
the null pointer).


Well, the null pointer is certainly valid for the purposes of copying the
pointer value and comparing it to other pointer values wrt. equality.

Unfortunately the standard does not fully define the terms invalid and valid
for pointers, giving only one example of invalid (pointing to deallocated
storage), and vaguely implying another (indeterminate pointer value).

As a working definition I prefer to consider the nullpointer a valid pointer
(as well as e.g. pointer to one past end of array), because that way one can
say simply that _any_ use of an invalid pointer is -- probably! --
Undefined Behavior (it would be nice if the standard was clear). For the
kinds of pointer this definition says are valid pointers there are then levels
of what you can do: no dereferencing (nullpointer), dereference but don't do
anything that requires an actual object (one past end of array, destroyed but
not deallocated object, zero size new'ed array), compare by equality but not
otherwise when using built-in operators (pointer to single object), and so on.

If we need a general term for a pointer that actually points to a useable
object -- and there is no term for it as far as I know, it certainly isn't
covered by general validity -- I propose we call them RealGood pointers.
Then those that are not RealGood are Un-RealGood, or URG, pointers. ;-) An
URG pointer can be valid or invalid, and if it's invalid, all uses are
(probably!) Undefined Behavior.

Otherwise one would have to get into gray-zones of validity.

--
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?
Oct 15 '05 #4

P: n/a
In article <43***************@news.individual.net>,
Alf P. Steinbach <al***@start.no> wrote:
* Greg Comeau:

need not be reset to something valid, or purposely invalid (like
the null pointer).


Well, the null pointer is certainly valid for the purposes of copying the
pointer value and comparing it to other pointer values wrt. equality.

Unfortunately the standard does not fully define the terms invalid and valid
for pointers, giving only one example of invalid (pointing to deallocated
storage), and vaguely implying another (indeterminate pointer value).

As a working definition I prefer to consider the nullpointer a valid pointer
(as well as e.g. pointer to one past end of array), because that way one can
say simply that _any_ use of an invalid pointer is -- probably! --
Undefined Behavior (it would be nice if the standard was clear). For the
kinds of pointer this definition says are valid pointers there are then levels
of what you can do: no dereferencing (nullpointer), dereference but don't do
anything that requires an actual object (one past end of array, destroyed but
not deallocated object, zero size new'ed array), compare by equality but not
otherwise when using built-in operators (pointer to single object), and so on.

If we need a general term for a pointer that actually points to a useable
object -- and there is no term for it as far as I know, it certainly isn't
covered by general validity -- I propose we call them RealGood pointers.
Then those that are not RealGood are Un-RealGood, or URG, pointers. ;-) An
URG pointer can be valid or invalid, and if it's invalid, all uses are
(probably!) Undefined Behavior.

Otherwise one would have to get into gray-zones of validity.


I agree that a null pointer is a valid pointer, at least as
far as null pointerness is concerned, and indeed it can be
copied, tested, etc. Quite so. I proably should have said
"purposely invalid" to acknowledge that, and that it does not
point at any valid memory. Hopefully that weasels me out of this :)
And let's leave void * out of eveything. More importantly,
I guess some invalid URGs can be a valid pointers it would seem :)
--
Greg Comeau / Celebrating 20 years of Comeauity!
Comeau C/C++ ONLINE ==> http://www.comeaucomputing.com/tryitout
World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
Oct 15 '05 #5

P: n/a
* Greg Comeau:
* Alf P. Steinbach:
If we need a general term for a pointer that actually points to a useable
object -- and there is no term for it as far as I know, it certainly isn't
covered by general validity -- I propose we call them RealGood pointers.
Then those that are not RealGood are Un-RealGood, or URG, pointers. ;-) An
URG pointer can be valid or invalid, and if it's invalid, all uses are
(probably!) Undefined Behavior.


I agree that a null pointer is a valid pointer, at least as
far as null pointerness is concerned, and indeed it can be
copied, tested, etc. Quite so. I proably should have said
"purposely invalid" to acknowledge that, and that it does not
point at any valid memory. Hopefully that weasels me out of this :)
And let's leave void * out of eveything. More importantly,
I guess some invalid URGs can be a valid pointers it would seem :)


Uh, well. Again. ;-) I meant for RealGood/URG and valid/invalid to largely
orthogonal concepts, except that RealGood implies valid. An invalid URG is
then just a pointer that is both URG (not RealGood) and invalid. Hence it is
invalid.

Cheers,

- Alf
PS: Is this distinction really useful, do you think?

--
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?
Oct 15 '05 #6

P: n/a

"__PPS__" <i-*********@yandex.ru> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
Hello everybody

in a quiz I had a question about dangling pointer:
"What a dangling pointer is and the danger of using it"

My answer was:
"dangling pointer is a pointer that points to some area of ram that's
not reserved by the program. Accessing memory through such pointer is
likely to result in core dump (memory access violation)"


Almost completely false.
Dangling pointer usually points to valid memory in program code,
except that pointed object was replaced by other object or
nothing is there any more (in that case it can point to memory
that is not accesible by the code any more).
As we all now "delete" and "free" are generators of dangling pointers,
but there are other cases as well.

example:

static char* buf = new char[sizeof(int)];

int *i = new(buf) int(10);
// .....
int *j = i;
*j = 42;
// ......

// and somewhere in code someone writes
int* k = new (buf) int(2);
// .......
j is now dangling pointer, points to wrong int.
then comes this assert
assert(*j == 42); // and assert fails
// programmer wonders why doesn't this work :)

That is about it.

Greetings, Bane.
Oct 16 '05 #7

P: n/a

Branimir Maksimovic wrote:
Hello everybody

in a quiz I had a question about dangling pointer:
"What a dangling pointer is and the danger of using it"

My answer was:
"dangling pointer is a pointer that points to some area of ram that's
not reserved by the program. Accessing memory through such pointer is
likely to result in core dump (memory access violation)"

Almost completely false.


"Almost completely false" means that dangling pointer is a pointer that
points to some area of ram that IS reserved by the program. Accessing
memory through such pointer is NOT likely to result in core dump
(memory access violation)
that's how I understand your sentence. Do you really think that I made
completely wrond answer ?!?!? As Greg pointed out, ther's no precice
definition of dangling pointer in c++, don't forget about that - many
thing could be dangling pointer.

Dangling pointer usually points to valid memory in program code,
I don't agree with you, even if you try google, you'll see that
dangling pointers are mostly called as pointers that point nowhere.
Well, you could be right, cause on most of the implementations if you
new an object and delete it and then new an object of the same class
again, it will most likely be constructed on the place of the
previously deleted one, and both pointers will point to the same new
object:
X *a = new X();
delete a;
X *b = new X();
? a==b ?, is a now dangling?

OR

int *i= new int;
delete i;
char *c= new char;
? i==c ?, also very likely, but from my definition i became dangling
after when I deleted i.
except that pointed object was replaced by other object or
nothing is there any more (in that case it can point to memory
that is not accesible by the code any more).
As we all now "delete" and "free" are generators of dangling pointers,
but there are other cases as well.

example:

static char* buf = new char[sizeof(int)];

int *i = new(buf) int(10);
// .....
int *j = i;
*j = 42;
// ......

// and somewhere in code someone writes
int* k = new (buf) int(2);
// .......
j is now dangling pointer, points to wrong int.
then comes this assert
assert(*j == 42); // and assert fails
// programmer wonders why doesn't this work :)


There's nothing wrong, it should assert, if placement new creates
int(2) at buf. Interesting thing in this case we will have to delete
buf three times now :)
PS. I forgot to mention the other part of the question that I felt
wasn't important. It was: "Explain in less thatn 5 short sentences What
dang..."
It's just beginners class, no complicated stuff necessary to get 3/3
for this question - just give right answer :)

Oct 16 '05 #8

P: n/a
* __PPS__:

in a quiz I had a question about dangling pointer:
"What a dangling pointer is and the danger of using it"

My answer was:
"dangling pointer is a pointer that points to some area of ram that's
not reserved by the program. Accessing memory through such pointer is
likely to result in core dump (memory access violation)"


A dangling pointer is a pointer value that was valid and has become invalid.

The key is the _transition_ from valid to invalid.

It's not defined in the C++ standard and has little to do with C++ except the
frequency with which dangling pointers occur in C++ programs. ;-)

The area of memory pointed to can still be reserved by the program, and in
fact that's most often the case.

For a lot of erronous details but also some enlightening ones, see <url:
http://en.wikipedia.org/wiki/Dangling_pointer> (who takes on the job?).

--
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?
Oct 16 '05 #9

P: n/a

"__PPS__" <i-*********@yandex.ru> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...

Branimir Maksimovic wrote:
> Hello everybody
>
> in a quiz I had a question about dangling pointer:
> "What a dangling pointer is and the danger of using it"
>
> My answer was:
> "dangling pointer is a pointer that points to some area of ram that's
> not reserved by the program. Accessing memory through such pointer is
> likely to result in core dump (memory access violation)"
>
Almost completely false.


"Almost completely false" means that dangling pointer is a pointer that
points to some area of ram that IS reserved by the program. Accessing
memory through such pointer is NOT likely to result in core dump
(memory access violation)
that's how I understand your sentence.


No, you missed the point. To resolve your confusion let's ask
another question:
What is the difference between dangling pointer
and wild pointer? Both can point to memory that is/not accessible
by program code.
Do you really think that I made completely wrond answer ?!?!?
Yes, you've missed the point.

As Greg pointed out, ther's no precice definition of dangling pointer in c++, don't forget about that - many
thing could be dangling pointer.
No, but that is common term.

Dangling pointer usually points to valid memory in program code,
I don't agree with you, even if you try google, you'll see that
dangling pointers are mostly called as pointers that point nowhere.


Problem is that all pointers point to somewhere.
Even NULL pointer can point to somewhere.
There are implementations where every pointer value refers to accessible
memory.
Well, you could be right, cause on most of the implementations if you
new an object and delete it and then new an object of the same class
again, it will most likely be constructed on the place of the
previously deleted one, and both pointers will point to the same new
object:
X *a = new X();
delete a;
X *b = new X();
? a==b ?, is a now dangling?
Of course.

OR

int *i= new int;
delete i;
char *c= new char;
? i==c ?, also very likely, but from my definition i became dangling
after when I deleted i.
Yes.


except that pointed object was replaced by other object or
nothing is there any more (in that case it can point to memory
that is not accesible by the code any more).
As we all now "delete" and "free" are generators of dangling pointers,
but there are other cases as well.

example:

static char* buf = new char[sizeof(int)];

int *i = new(buf) int(10);
// .....
int *j = i;
*j = 42;
// ......

// and somewhere in code someone writes
int* k = new (buf) int(2);
// .......
j is now dangling pointer, points to wrong int.
then comes this assert
assert(*j == 42); // and assert fails
// programmer wonders why doesn't this work :)
There's nothing wrong, it should assert, if placement new creates
int(2) at buf. Interesting thing in this case we will have to delete
buf three times now :)


What is the difference between this example and delete new cycle?
It is actually what happens in implementation
of new and delete, just simplified :)


PS. I forgot to mention the other part of the question that I felt
wasn't important. It was: "Explain in less thatn 5 short sentences What
dang..."
It's just beginners class, no complicated stuff necessary to get 3/3
for this question - just give right answer :)

Well simply explained, let's say Merry had telephone number
111-2222-333. For some reason Merry moved out to other place,
and you can't call her with that number anymore. Let's say when
you call that number now Mark answers the phone.
Such number is called dangling pointer. :)

Greetings, Bane.

Oct 16 '05 #10

P: n/a

"Alf P. Steinbach" <al***@start.no> wrote in message
news:43***************@news.individual.net...
* __PPS__:

in a quiz I had a question about dangling pointer:
"What a dangling pointer is and the danger of using it"

My answer was:
"dangling pointer is a pointer that points to some area of ram that's
not reserved by the program. Accessing memory through such pointer is
likely to result in core dump (memory access violation)"


A dangling pointer is a pointer value that was valid and has become
invalid.

The key is the _transition_ from valid to invalid.

It's not defined in the C++ standard and has little to do with C++ except
the
frequency with which dangling pointers occur in C++ programs. ;-)

The area of memory pointed to can still be reserved by the program, and in
fact that's most often the case.

For a lot of erronous details but also some enlightening ones, see <url:
http://en.wikipedia.org/wiki/Dangling_pointer> (who takes on the job?).

Heh, they say that dangling pointer is wild pointer. That's true in some
sense, but wild pointer is unitialized pointer and dangling pointer is
initialized
one :)

Greetings, Bane.

Oct 16 '05 #11

P: n/a

"Alf P. Steinbach" <al***@start.no> wrote in message
news:43***************@news.individual.net...
* __PPS__:

in a quiz I had a question about dangling pointer:
"What a dangling pointer is and the danger of using it"

My answer was:
"dangling pointer is a pointer that points to some area of ram that's
not reserved by the program. Accessing memory through such pointer is
likely to result in core dump (memory access violation)"


A dangling pointer is a pointer value that was valid and has become
invalid.

The key is the _transition_ from valid to invalid.

It's not defined in the C++ standard and has little to do with C++ except
the
frequency with which dangling pointers occur in C++ programs. ;-)

The area of memory pointed to can still be reserved by the program, and in
fact that's most often the case.

For a lot of erronous details but also some enlightening ones, see <url:
http://en.wikipedia.org/wiki/Dangling_pointer> (who takes on the job?).


http://en.wikipedia.org/wiki/Wild_pointer

Look at this contradictions of definitons :) They have to decide what is
what.

Greetings, Bane.
Oct 16 '05 #12

P: n/a
> No, you missed the point. To resolve your confusion let's ask
another question:
What is the difference between dangling pointer
and wild pointer? Both can point to memory that is/not accessible
by program code.
Do you really think that I made
completely wrond answer ?!?!?
Yes, you've missed the point.


Yes means I made completely wrong answer, is that what you meant? Be
clear
Or you're saying that I gave difenition to wild pointer :) well, in
some schools same things can be called differently, so let's call all
of them dangling to avoid further confusion...
The thing is that I agree that there are many cases/ways to create
dangling pointers, but you don't seem to agree with my answer that
pointer pointing to memory unreserved by the process is dangling.

int *foo(){
int x;
return &x;
}

returns a dangling pointer, but the returned address is likely to be
somewhere within plogram's instruction's block, in this case my answer
is wrong

-OR-
int *b =new int;
int *a =0x554345;
a is certanly a dangling pointer :), but there is a small chance that
a==b

As Greg pointed out, ther's no precice
definition of dangling pointer in c++, don't forget about that - many
thing could be dangling pointer.
No, but that is common term.

Dangling pointer usually points to valid memory in program code,


I don't agree with you, even if you try google, you'll see that
dangling pointers are mostly called as pointers that point nowhere.


Problem is that all pointers point to somewhere.
Even NULL pointer can point to somewhere.


but NULL pointer is not dangling
There are implementations where every pointer value refers to accessible
memory.
Well, you could be right, cause on most of the implementations if you
new an object and delete it and then new an object of the same class
again, it will most likely be constructed on the place of the
previously deleted one, and both pointers will point to the same new
object:
X *a = new X();
delete a;
X *b = new X();
? a==b ?, is a now dangling?
Of course.


I seem to made a point against myself here :) I have show that pointer
pointing to reserved memory is dangling, forget about this example ;)

OR

int *i= new int;
delete i;
char *c= new char;
? i==c ?, also very likely, but from my definition i became dangling
after when I deleted i.


Yes.


except that pointed object was replaced by other object or
nothing is there any more (in that case it can point to memory
that is not accesible by the code any more).
As we all now "delete" and "free" are generators of dangling pointers,
but there are other cases as well.

example:

static char* buf = new char[sizeof(int)];

int *i = new(buf) int(10);
// .....
int *j = i;
*j = 42;
// ......

// and somewhere in code someone writes
int* k = new (buf) int(2);
// .......
j is now dangling pointer, points to wrong int.
then comes this assert
assert(*j == 42); // and assert fails
// programmer wonders why doesn't this work :)


There's nothing wrong, it should assert, if placement new creates
int(2) at buf. Interesting thing in this case we will have to delete
buf three times now :)


What is the difference between this example and delete new cycle?
It is actually what happens in implementation
of new and delete, just simplified :)


PS. I forgot to mention the other part of the question that I felt
wasn't important. It was: "Explain in less thatn 5 short sentences What
dang..."
It's just beginners class, no complicated stuff necessary to get 3/3
for this question - just give right answer :)

Well simply explained, let's say Merry had telephone number
111-2222-333. For some reason Merry moved out to other place,
and you can't call her with that number anymore. Let's say when
you call that number now Mark answers the phone.
Such number is called dangling pointer. :)

Greetings, Bane.

But what happens if no one picks up? or you hear that the number is not
in service? doesn't that also mean a dangling pointer. You say I'm
completely wrong because I missed the point. Someone in this thread has
pointed out that my answer wasn't full, so 2/3 is ok for my answer,
what you are saying is that it should be 0/3 cause: "Do you really
think that I made completely wrong answer ?!?!?" - "Yes,...", and
completely wrong means 0/8

Thanks you everybody for your answers, in case someone asks me, I'll be
able to give a better answer on this question :)

Oct 16 '05 #13

P: n/a
> what you are saying is that it should be 0/3 cause: "Do you really
think that I made completely wrong answer ?!?!?" - "Yes,...", and
completely wrong means 0/8

Hey, that was infinity sign, don't know why google flipped it :)

Oct 16 '05 #14

P: n/a
In article <di**********@news.eunet.yu>,
Branimir Maksimovic <bm***@eunet.yu> wrote:
Well simply explained, let's say Merry had telephone number
111-2222-333. For some reason Merry moved out to other place,
and you can't call her with that number anymore. Let's say when
you call that number now Mark answers the phone.
Such number is called dangling pointer. :)


Come on. Everybody knows that's called being stood up.
--
Greg Comeau / Celebrating 20 years of Comeauity!
Comeau C/C++ ONLINE ==> http://www.comeaucomputing.com/tryitout
World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
Oct 16 '05 #15

P: n/a

"__PPS__" <i-*********@yandex.ru> wrote in message
news:11*********************@g44g2000cwa.googlegro ups.com...
No, you missed the point. To resolve your confusion let's ask
another question:
What is the difference between dangling pointer
and wild pointer? Both can point to memory that is/not accessible
by program code.
Do you really think that I made
> completely wrond answer ?!?!?
Yes, you've missed the point.


Yes means I made completely wrong answer, is that what you meant? Be
clear
Or you're saying that I gave difenition to wild pointer :) well, in
some schools same things can be called differently, so let's call all
of them dangling to avoid further confusion...
The thing is that I agree that there are many cases/ways to create
dangling pointers, but you don't seem to agree with my answer that
pointer pointing to memory unreserved by the process is dangling.


I said almost completely false.

int *foo(){
int x;
return &x;
}

returns a dangling pointer, but the returned address is likely to be
somewhere within plogram's instruction's block, in this case my answer
is wrong

-OR-
int *b =new int;
int *a =0x554345;
a is certanly a dangling pointer :), but there is a small chance that
a==b
int *a = reinterpret_cast<int*>(0x554345);

No, a is not dangling pointer. You've initialized it with specific value
which you expect leads to non const integer object. This may be correct
or incorrect, but implementation allows you to that :)
There is nothing dangling here.

you have to do
new (reinterpret_cast<void*>(0x554345)) float(3.4);
to make a into dangling pointer.

As Greg pointed out, ther's no precice
> definition of dangling pointer in c++, don't forget about that - many
> thing could be dangling pointer.
No, but that is common term.
>
>
>> Dangling pointer usually points to valid memory in program code,
>
> I don't agree with you, even if you try google, you'll see that
> dangling pointers are mostly called as pointers that point nowhere.


Problem is that all pointers point to somewhere.
Even NULL pointer can point to somewhere.


but NULL pointer is not dangling


You said nowhere?
> PS. I forgot to mention the other part of the question that I felt
> wasn't important. It was: "Explain in less thatn 5 short sentences What
> dang..."
> It's just beginners class, no complicated stuff necessary to get 3/3
> for this question - just give right answer :)

Well simply explained, let's say Merry had telephone number
111-2222-333. For some reason Merry moved out to other place,
and you can't call her with that number anymore. Let's say when
you call that number now Mark answers the phone.
Such number is called dangling pointer. :)

Greetings, Bane.

But what happens if no one picks up? or you hear that the number is not
in service? doesn't that also mean a dangling pointer.


Of course.

You say I'm completely wrong because I missed the point. Someone in this thread has
pointed out that my answer wasn't full, so 2/3 is ok for my answer,
what you are saying is that it should be 0/3 cause: "Do you really
think that I made completely wrong answer ?!?!?" - "Yes,...", and
completely wrong means 0/8
No, I'm saying that you were almost completely false, but I would give
you 3 since there is no definition of dangling pointer in C++.
So any answer is valid regarding C++. :)

Thanks you everybody for your answers, in case someone asks me, I'll be
able to give a better answer on this question :)


Greetings, Bane.
Oct 16 '05 #16

P: n/a
In article <di**********@news.eunet.yu>,
Branimir Maksimovic <bm***@eunet.yu> wrote:
but wild pointer is unitialized pointer


A wild pointer is a pointer that is wild,
unitialized or not.
--
Greg Comeau / Celebrating 20 years of Comeauity!
Comeau C/C++ ONLINE ==> http://www.comeaucomputing.com/tryitout
World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
Oct 16 '05 #17

P: n/a
In article <11*********************@g44g2000cwa.googlegroups. com>,
__PPS__ <i-*********@yandex.ru> wrote:
Thanks you everybody for your answers, in case someone asks me, I'll be
able to give a better answer on this question :)


Provide one now! :)
--
Greg Comeau / Celebrating 20 years of Comeauity!
Comeau C/C++ ONLINE ==> http://www.comeaucomputing.com/tryitout
World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
Oct 16 '05 #18

P: n/a

"Greg Comeau" <co****@panix.com> wrote in message
news:di**********@panix2.panix.com...
In article <di**********@news.eunet.yu>,
Branimir Maksimovic <bm***@eunet.yu> wrote:
Well simply explained, let's say Merry had telephone number
111-2222-333. For some reason Merry moved out to other place,
and you can't call her with that number anymore. Let's say when
you call that number now Mark answers the phone.
Such number is called dangling pointer. :)


Come on. Everybody knows that's called being stood up.


Good one !

Greetings, Bane.

Oct 16 '05 #19

P: n/a

"Greg Comeau" <co****@panix.com> wrote in message
news:di**********@panix2.panix.com...
In article <di**********@news.eunet.yu>,
Branimir Maksimovic <bm***@eunet.yu> wrote:
but wild pointer is unitialized pointer


A wild pointer is a pointer that is wild,
unitialized or not.


So dangling pointer is wild pointer but wild pointer is not necessarily
dangling pointer? Ok, I used term wild pointer just for unitialized ones.

Greetings, Bane.
Oct 16 '05 #20

P: n/a

Greg Comeau wrote:
In article <di**********@news.eunet.yu>,
Branimir Maksimovic <bm***@eunet.yu> wrote:
Well simply explained, let's say Merry had telephone number
111-2222-333. For some reason Merry moved out to other place,
and you can't call her with that number anymore. Let's say when
you call that number now Mark answers the phone.
Such number is called dangling pointer. :)


Come on. Everybody knows that's called being stood up.

Forget me please, I didn't understand what you mean.
Does that mean something that Mary doesn't want you call her anymore :)
or what (I had to take some ESL classes in university before I could
write posts to comp.lang.c++ :)

Oct 16 '05 #21

This discussion thread is closed

Replies have been disabled for this discussion.