Sure, this is implied within an object, but to be able to create a ** pointer to the object you first need to store this somewhere.
I still don't see where you need to have a ** pointer to this. If internally, it's implied. If external, I get the pointer when I new up the object. If I'm missing something, please illustrate with a code snippet.
I still don't see where you need to have a ** pointer to this. If internally, it's implied. If external, I get the pointer when I new up the object. If I'm missing something, please illustrate with a code snippet.
For the first time in my life I'me going to quit a forum without being banned.
Thank you all and good luck.
nuzzle,
you've been here far, far less than me,
but notice how you already have 2 green light reputation and I don't.
that means, you've done something right during your short stay here at the CG,
and that those people were helped by you.
The debate on this thread got little hot, no doubt about it.
But it is in this flame that all of us are forged,
for the reasons too hard to understand and too painful to accept,
to take the next hammering of the blacksmith.
So for the sake of people who might need your help in days to come,
I hope you stick around.
Indeed! The impersonal nature of web-based debate can result in very "thick skin" when compared with face-to-face discussions. Don't take it personally.
I seriously would like a code sample that demostrates the logic of having a pointer that points to the temporary r-value pointer of "this" :S. Of course the op doesn't need to do such a thing. he thinks the "this" is an object and not a pointer to the object itself. If anyone knows c++, they know how "this" is typically implemented. They know that it gets pushed on the stack as a parameter for the member function being called.
like
if( Kid.isChild() ) cout << "Yes" << endl;
would be
if( isChild( &Kid ) cout << "Yes" << endl;
that is psuedo code btw
That code makes sense why you shouldn't copy the address of where the pointers is located( &this ) since it is push on the stack and has limited life scope. It will no longer be valid after the member function is called. This is what Paul meant, i believe, when saying why would you need to do this?? It is just not logical
The op clearly thought that "this" was an object and not a pointer to the object itself
Again I seriously would like a code sample by Nuzzle that demostrates the logic of having a pointer that points to the temporary r-value pointer of "this" :S
TEMPLT void List<t>::add(const t* obj, int len){//len is 1 by default
if(totalSize-objectCount < len) increaseSize(len);
for(int i=0; i<len; i++)
contents[i+objectCount] = obj[i];
objectCount+=len;
}
<= is the opposite of >, but I used < because it made more sense....
the original code said totalSize-objectCount > len.., but let's say
(10 - 5 > 5) = (5 > 5) == false. if false, increaseSize( 5 ), but i think it should say
(10 - 5 >= 5) = (5 >= 5) == true. if false, increaseSize( 5 ). I think this is right if the totalSize is the total amount in which the list is allocated to hold?
Maybe I am wrong, but I don't see the full implementation either
Also Nuzzle, please relax some. No one here is going to flame you unless you're "very!" incorrect or touch a soft topic
Also feel free to correct me if I am wrong, but be sure you understand what I meant
Last edited by Joeman; May 24th, 2012 at 08:02 AM.
Reason: spelling
Bookmarks