Click here to Skip to main content
15,887,596 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
JokeRe: Plz, Help! win32 - edges on buttons Pin
Rajesh R Subramanian17-Apr-08 2:01
professionalRajesh R Subramanian17-Apr-08 2:01 
GeneralRe: Plz, Help! win32 - edges on buttons Pin
CPallini17-Apr-08 2:06
mveCPallini17-Apr-08 2:06 
JokeRe: Plz, Help! win32 - edges on buttons Pin
Cedric Moonen17-Apr-08 2:08
Cedric Moonen17-Apr-08 2:08 
GeneralRe: Plz, Help! win32 - edges on buttons Pin
Hamid_RT17-Apr-08 1:36
Hamid_RT17-Apr-08 1:36 
GeneralRe: Plz, Help! win32 - edges on buttons Pin
Member 382549317-Apr-08 3:17
Member 382549317-Apr-08 3:17 
Generalcode analysis Pin
saqib8216-Apr-08 23:26
saqib8216-Apr-08 23:26 
GeneralRe: code analysis Pin
Cedric Moonen16-Apr-08 23:45
Cedric Moonen16-Apr-08 23:45 
GeneralDetect if pointer points to the stack or the heap Pin
piul16-Apr-08 21:55
piul16-Apr-08 21:55 
I have a list (CList) of pointers. Some of them point to variables in the heap a some others not.
I've defined a destructor that frees the memory space, but the program crashes when I delete a pointer to a variable in the stack.

The question is, is there any way of detecting if a pointer points to a variable in the stack or in the heap??

CMyList::~CMyList()
{
   POSITION pos = GetHeadPosition();
   while (pos != NULL)
   {
      if (GetNext(pos) points to the heap)   //????
         delete GetAt(pos);
   }
   RemoveAll();
}

GeneralRe: Detect if pointer points to the stack or the heap [modified] Pin
Naveen16-Apr-08 23:13
Naveen16-Apr-08 23:13 
GeneralRe: Detect if pointer points to the stack or the heap Pin
Cedric Moonen16-Apr-08 23:25
Cedric Moonen16-Apr-08 23:25 
GeneralRe: Detect if pointer points to the stack or the heap Pin
piul16-Apr-08 23:36
piul16-Apr-08 23:36 
GeneralRe: Detect if pointer points to the stack or the heap Pin
CPallini16-Apr-08 23:53
mveCPallini16-Apr-08 23:53 
GeneralRe: Detect if pointer points to the stack or the heap Pin
Moak17-Apr-08 0:20
Moak17-Apr-08 0:20 
GeneralRe: Detect if pointer points to the stack or the heap Pin
James R. Twine17-Apr-08 8:05
James R. Twine17-Apr-08 8:05 
GeneralRe: Detect if pointer points to the stack or the heap Pin
Naveen17-Apr-08 14:03
Naveen17-Apr-08 14:03 
GeneralRe: Detect if pointer points to the stack or the heap Pin
Stephen Hewitt17-Apr-08 15:20
Stephen Hewitt17-Apr-08 15:20 
GeneralGet ProjectName at compiletime Pin
hansipet16-Apr-08 20:43
hansipet16-Apr-08 20:43 
GeneralRe: Get ProjectName at compiletime Pin
Hamid_RT16-Apr-08 20:46
Hamid_RT16-Apr-08 20:46 
AnswerRe: Get ProjectName at compiletime Pin
Rajkumar R16-Apr-08 21:45
Rajkumar R16-Apr-08 21:45 
GeneralRe: Get ProjectName at compiletime Pin
CPallini16-Apr-08 23:40
mveCPallini16-Apr-08 23:40 
GeneralCalculating System measurements in MFC Pin
nisha0000016-Apr-08 17:16
nisha0000016-Apr-08 17:16 
GeneralRe: Calculating System measurements in MFC Pin
_AnsHUMAN_ 16-Apr-08 18:12
_AnsHUMAN_ 16-Apr-08 18:12 
GeneralRe: Calculating System measurements in MFC Pin
nisha0000016-Apr-08 18:36
nisha0000016-Apr-08 18:36 
GeneralRe: Calculating System measurements in MFC Pin
Maruf Maniruzzaman16-Apr-08 19:00
Maruf Maniruzzaman16-Apr-08 19:00 
QuestionRe: Calculating System measurements in MFC Pin
Rajesh R Subramanian16-Apr-08 19:29
professionalRajesh R Subramanian16-Apr-08 19:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.