Click here to Skip to main content
15,921,028 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Regular expression Pin
BobInNJ13-Mar-09 12:44
BobInNJ13-Mar-09 12:44 
GeneralRe: Regular expression Pin
Demian Panello13-Mar-09 14:19
Demian Panello13-Mar-09 14:19 
QuestionI Think I need to free Something Pin
BobInNJ13-Mar-09 11:38
BobInNJ13-Mar-09 11:38 
AnswerRe: I Think I need to free Something Pin
Stuart Dootson13-Mar-09 13:54
professionalStuart Dootson13-Mar-09 13:54 
GeneralRe: I Think I need to free Something Pin
BobInNJ14-Mar-09 13:16
BobInNJ14-Mar-09 13:16 
GeneralRe: I Think I need to free Something Pin
Stuart Dootson14-Mar-09 13:24
professionalStuart Dootson14-Mar-09 13:24 
GeneralRe: I Think I need to free Something Pin
BobInNJ14-Mar-09 14:16
BobInNJ14-Mar-09 14:16 
GeneralRe: I Think I need to free Something Pin
Stuart Dootson14-Mar-09 18:53
professionalStuart Dootson14-Mar-09 18:53 
Yes, that's correct. It uses a well-known C++ idiom called 'Resource Acquisition is Initialisation', or RAII[^].

Basically, this translates to "If you can tie the lifetime of some resource (like a BRUSH) ot a C++ object, you can allocate the resources in the constructor[^] and deallocate it in the destructor".

Unfortunately, the MFC documentation for MFC GDI object wrappers doesn't explicitly say "the GDI object is deleted in the CGDIObject destructor" - the closest it comes is in the description of using a GDI object allocated on the stack - "Allow the frame-allocated graphic object to be deleted automatically when the scope is exited"[^]. This advice holds just as true for a GDI object that is a data member of a class instance.

Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

QuestionMemory Leakege Reporting without line number Pin
Member 349347313-Mar-09 11:09
Member 349347313-Mar-09 11:09 
AnswerRe: Memory Leakege Reporting without line number Pin
Stuart Dootson13-Mar-09 13:50
professionalStuart Dootson13-Mar-09 13:50 
GeneralRe: Memory Leakege Reporting without line number Pin
Member 349347314-Mar-09 11:27
Member 349347314-Mar-09 11:27 
Questionhow do I, amend a bitmap a run time Pin
simon alec smith13-Mar-09 9:02
simon alec smith13-Mar-09 9:02 
QuestionRe: how do I, amend a bitmap a run time Pin
CPallini13-Mar-09 9:11
mveCPallini13-Mar-09 9:11 
AnswerRe: how do I, amend a bitmap a run time Pin
Hamid_RT13-Mar-09 19:48
Hamid_RT13-Mar-09 19:48 
QuestionI find an interesting and confusing code..have a look. Pin
JackPuppy13-Mar-09 8:39
JackPuppy13-Mar-09 8:39 
AnswerRe: I find an interesting and confusing code..have a look. Pin
led mike13-Mar-09 8:49
led mike13-Mar-09 8:49 
GeneralRe: I find an interesting and confusing code..have a look. Pin
JackPuppy13-Mar-09 8:55
JackPuppy13-Mar-09 8:55 
GeneralRe: I find an interesting and confusing code..have a look. Pin
David Crow13-Mar-09 8:58
David Crow13-Mar-09 8:58 
GeneralRe: I find an interesting and confusing code..have a look. Pin
JackPuppy13-Mar-09 9:03
JackPuppy13-Mar-09 9:03 
QuestionRe: I find an interesting and confusing code..have a look. Pin
David Crow13-Mar-09 9:07
David Crow13-Mar-09 9:07 
JokeRe: I find an interesting and confusing code..have a look. Pin
CPallini13-Mar-09 9:09
mveCPallini13-Mar-09 9:09 
GeneralRe: I find an interesting and confusing code..have a look. Pin
led mike13-Mar-09 9:03
led mike13-Mar-09 9:03 
GeneralRe: I find an interesting and confusing code..have a look. Pin
CPallini13-Mar-09 9:07
mveCPallini13-Mar-09 9:07 
GeneralRe: I find an interesting and confusing code..have a look. Pin
JackPuppy13-Mar-09 9:30
JackPuppy13-Mar-09 9:30 
GeneralRe: I find an interesting and confusing code..have a look. Pin
bulg13-Mar-09 10:35
bulg13-Mar-09 10:35 

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.