Click here to Skip to main content
15,906,645 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to get name of a file opened by Open dialog box? Pin
Jeff Patterson28-Nov-02 6:45
Jeff Patterson28-Nov-02 6:45 
GeneralRe: How to get name of a file opened by Open dialog box? Pin
Azadeh28-Nov-02 8:44
Azadeh28-Nov-02 8:44 
GeneralCan I close the file opened by Open dialog box? Pin
Azadeh29-Nov-02 2:52
Azadeh29-Nov-02 2:52 
GeneralRe: Can I close the file opened by Open dialog box? Pin
jhwurmbach29-Nov-02 3:48
jhwurmbach29-Nov-02 3:48 
GeneralRe: Can I close the file opened by Open dialog box? Pin
Azadeh29-Nov-02 8:44
Azadeh29-Nov-02 8:44 
GeneralStatic member variable pointer. Pin
Jawache28-Nov-02 5:18
Jawache28-Nov-02 5:18 
GeneralRe: Static member variable pointer. Pin
Nick Parker28-Nov-02 5:23
protectorNick Parker28-Nov-02 5:23 
GeneralRe: Static member variable pointer. Pin
Alvaro Mendez29-Nov-02 4:33
Alvaro Mendez29-Nov-02 4:33 
Here are some points to consider:

1. If the value of _poo will never change, in other words, it will never be reassigned to a different object, then:

  • It doesn't really need to be deleted -- the program will clean it up when it exits. However, if you run the program in the DevStudio debugger, you'll get a message about a memory block that wasn't freed, which for this case is harmless, but it's better to not have it so that it's not confused with real leaks.
  • You don't really need to make _poo a pointer to Poo. You can make it a Poo object directly:

    class Poo
    {
      static Poo _poo;
    };
     
    Poo Poo::_poo;



2. If the value of _poo (as you have it) will change, then you will obviously need to free the memory that it points to before reassigning it. Otherwise you'll have memory leaks.

Regards,
Alvaro


Well done is better than well said. -- Benjamin Franklin
(I actually prefer medium-well.)
GeneralIcon in Cedit Pin
Woody Green28-Nov-02 4:42
Woody Green28-Nov-02 4:42 
GeneralRe: Icon in Cedit Pin
Maximilien28-Nov-02 4:56
Maximilien28-Nov-02 4:56 
GeneralRe: Icon in Cedit Pin
Iain Clarke, Warrior Programmer28-Nov-02 22:58
Iain Clarke, Warrior Programmer28-Nov-02 22:58 
GeneralRe: Icon in Cedit Pin
Joan M29-Nov-02 5:44
professionalJoan M29-Nov-02 5:44 
GeneralRe: Icon in Cedit Pin
Woody Green8-Dec-02 20:48
Woody Green8-Dec-02 20:48 
QuestionAdding file object link in CRichEdit is very slowly? Pin
zjkw28-Nov-02 4:07
zjkw28-Nov-02 4:07 
GeneralSTL iterators Pin
Hans Ruck28-Nov-02 3:58
Hans Ruck28-Nov-02 3:58 
GeneralRe: STL iterators Pin
Nick Parker28-Nov-02 4:15
protectorNick Parker28-Nov-02 4:15 
GeneralRe: STL iterators Pin
Hans Ruck28-Nov-02 4:22
Hans Ruck28-Nov-02 4:22 
GeneralRe: STL iterators Pin
Nick Parker28-Nov-02 4:56
protectorNick Parker28-Nov-02 4:56 
GeneralRe: STL iterators Pin
Hans Ruck28-Nov-02 5:00
Hans Ruck28-Nov-02 5:00 
GeneralRe: STL iterators Pin
Maximilien28-Nov-02 5:00
Maximilien28-Nov-02 5:00 
GeneralRe: STL iterators Pin
Hans Ruck28-Nov-02 5:04
Hans Ruck28-Nov-02 5:04 
QuestionHow to get the HINSTANCE of a dll? Pin
Juergen28-Nov-02 3:45
Juergen28-Nov-02 3:45 
GeneralCButton derived class Pin
Anonymous28-Nov-02 3:44
Anonymous28-Nov-02 3:44 
Generalwinpopup Pin
viliam28-Nov-02 2:33
viliam28-Nov-02 2:33 
GeneralRe: winpopup Pin
Simon.W28-Nov-02 2:57
Simon.W28-Nov-02 2:57 

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.