473,322 Members | 1,287 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,322 software developers and data experts.

Dangling pointer quiz question

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
20 6493
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
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
* 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
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
* 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

"__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

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
* __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

"__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

"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

"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
> 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
> 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
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

"__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
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
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

"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

"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

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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Aravind | last post by:
I would like to know in what manner dangling pointers affect the security of a application developed using C++.What are the loopholes that are created by dangling pointers and how they could be...
11
by: John | last post by:
Hi: Below is a simple code: class link1 { public: link1(); link1(int &b1, double &b2); int* a1;
2
by: Sketcher | last post by:
Hi, I am trying to create a quiz, Code is as follows: <html> <head> <title>Quiz</title> </head> <BODY> <Center><TABLE cellSpacing=3 cellPadding=0 border=0>
5
by: Richard | last post by:
My experience has always been that you're SOL when trying to safely detect and stop references to dangling memory (non-null pointers to free'ed blocks) at runtime (C99, Linux). Maybe somebody...
4
by: DAL | last post by:
I want to build my kid a program that cycles through questions (using a label for the question), and lets him choose one of two radio buttons for the right answer. How do I get every set of...
1
by: sekhar_ps | last post by:
if we store some value at the place in memory which void pointer references then we increment void pointer this leads to dangling pointer?can any one explain whats the reasons for dangling pointer
0
by: dradhakr | last post by:
I need to put 5 question only,that's randomly in flash,how can i write script in flash <?xml version="1.0"?> <!DOCTYPE quiz > <quiz> <title>The Quiz</title> <items> <item>...
5
by: madhusagar79 | last post by:
I got one issue to find the Dangling Pointer. Is there any way to find the Dangling Pointer?
1
by: sridhard2406 | last post by:
Hi All, I have a doubt on undrestanding Dangling pointers.Below I mentioned sample code. please let me know, my view on Dangling pointers is correct or not? main( ) ...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.