Linked Questions
14 questions linked to/from C++ Is it possible to determine whether a pointer points to a valid object?
0 votes
2 answers
5k views
How do i check whether the pointer is deleted or not in C++ [duplicate]
I have written following array pointer program in C++. I have deleted the pointer, but i am not able to confirm whether the pointer is deleted or not. Thanks in advance! #include<iostream> ...
-1 votes
1 answer
307 views
Is it possible to determine if a pointer points to a valid object, and if so how? [duplicate]
I was reading C++ Is it possible to determine whether a pointer points to a valid object? and the correct answer in this thread is that no, you can't do that, but the thread is quite old now and I ...
-2 votes
1 answer
689 views
How to make sure a pointer to a memory address is valid? [duplicate]
I wrote the following function: template <typename T> void SetPointer(DWORD64 base, vector<DWORD>Offsets, T value){ base = *reinterpret_cast<DWORD64*>(base); for (int i = 0; i < ...
-1 votes
6 answers
2k views
How to check c++ pointer pointing to invalid memory address? [duplicate]
Is there anyone show me how to check my pointer is pointing to an invalid memory address. #include<iostream> class Node{ public: int data; Node * next , * prev; }; // Driver Code int ...
1 vote
2 answers
271 views
How to validate deleted pointer? [duplicate]
May be this is very dumb question. But I don't know answer to this. If object to which pointer is referring is deleted by someone( we don't know who is deleting it ), but I still have raw pointer to ...
1 vote
0 answers
58 views
C++ How to deal with Invalid Pointers/Zero Pointers [duplicate]
I was given an integer pointer (passed through a function) which I can't modify that can possibly point to invalid memory or is a zero-pointer. I need to know if there's a way to check whether or not ...
0 votes
0 answers
47 views
C++ Array of object pointers - amount of valid objects [duplicate]
in my little example I have created an array of the size 5 and added 3 car pointers to it. So there are 2 slots unfilled. Question: How is it possible to find out how many pointers to cars are valid ( ...
103 votes
29 answers
116k views
Testing pointers for validity (C/C++)
Is there any way to determine (programatically, of course) if a given pointer is "valid"? Checking for NULL is easy, but what about things like 0x00001234? When trying to dereference this kind of ...
189 votes
6 answers
92k views
How much is the overhead of smart pointers compared to normal pointers in C++?
How much is the overhead of smart pointers compared to normal pointers in C++11? In other words, is my code going to be slower if I use smart pointers, and if so, how much slower? Specifically, I'm ...
0 votes
1 answer
2k views
Can we check a pointer to make sure it is a valid address?
My idea is to print the object it points to. I think a valid pointer should have a valid object. If we try to print out the object we verify if the pointer is valid. Am I right?
2 votes
3 answers
891 views
Visual Studio trigger a breakpoint, if the pointer is pointing to invalid memory
I'm working with visual studio IDE, I need to break my program at a particular place if a pointer at the same line pointing to a invalid memory (already deleted memory). is there a way to do that?
2 votes
1 answer
1k views
How to check if a pointer is valid in C++?
I have been given an interview question to write a Memory Manager (memory pool). I am almost done, but I have problems with deallocating. It is also fine to ask for help, as along as we mention the ...
0 votes
1 answer
358 views
Way to ensure a dynamically allocated matrix is square?
I would like to determine if there is a way to determine whether a dynamically allocated matrix is square (nxn). The first thing that came to mind was to see if there is a way to find out whether a ...
-1 votes
1 answer
92 views
How do you find out if memory that was dynamically allocated is emptied?
I am currently doing some dynamic programming in C++ using QT creator. Is there a way to know if a piece of memory that I allocated dynamically is emptied out at the end of a function? EDIT: I am ...