Click here to Skip to main content
15,919,749 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Exporting data to mutiple.txt files Pin
CPallini14-Jun-07 10:27
mveCPallini14-Jun-07 10:27 
AnswerRe: Exporting data to mutiple.txt files Pin
David Crow14-Jun-07 10:35
David Crow14-Jun-07 10:35 
AnswerRe: Exporting data to mutiple.txt files Pin
led mike14-Jun-07 10:44
led mike14-Jun-07 10:44 
QuestionForced scoping as a programming technique? Pin
Cyrilix14-Jun-07 5:53
Cyrilix14-Jun-07 5:53 
AnswerRe: Forced scoping as a programming technique? Pin
Michael Dunn14-Jun-07 6:27
sitebuilderMichael Dunn14-Jun-07 6:27 
GeneralRe: Forced scoping as a programming technique? Pin
Nemanja Trifunovic14-Jun-07 6:28
Nemanja Trifunovic14-Jun-07 6:28 
GeneralRe: Forced scoping as a programming technique? Pin
Cyrilix14-Jun-07 6:43
Cyrilix14-Jun-07 6:43 
GeneralRe: Forced scoping as a programming technique? Pin
jbarton14-Jun-07 8:53
jbarton14-Jun-07 8:53 
You said that you are using an STL container to keep track of pointers. Since you are using C++, you really should consider changing from using macros to instead use inline routines. Except for certain special diagnostic or logging routines (where you want to access preprocessor macros such as __FILE__ or __LINE__), there normally isn't any need to use macros in C++ for blocks of code.

In this case, it sounds like you should just make a small inline routine which declares and initializes the variables needed to call your other routine. This small routine can then be used as many times as you want, as the scope of the variables are within the routine. By making it inline, there should be no additional overhead beyond what you would get from a macro. You also won't need to pass in a number as a token parameter, as you won't get variable redefinitions if you use an inline routine instead of a macro.

As far as keep tracking of pointers to delete, I would suggest that you instead use an appropriate smart pointer, using the lightest weight smart pointer that you can. For many simple cases, an std::auto_ptr is sufficient or even a boost::scoped_ptr will work. For more complicated cases, a reference counting smart pointer such as boost::shared_ptr might be needed. Without knowing how you are using the pointers, I couldn't tell which would be a better choice.


GeneralRe: Forced scoping as a programming technique? Pin
Cyrilix14-Jun-07 9:38
Cyrilix14-Jun-07 9:38 
GeneralRe: Forced scoping as a programming technique? Pin
jbarton14-Jun-07 9:57
jbarton14-Jun-07 9:57 
GeneralRe: Forced scoping as a programming technique? Pin
Cyrilix14-Jun-07 10:38
Cyrilix14-Jun-07 10:38 
GeneralRe: Forced scoping as a programming technique? Pin
jbarton15-Jun-07 3:20
jbarton15-Jun-07 3:20 
GeneralRe: Forced scoping as a programming technique? [modified] Pin
Cyrilix15-Jun-07 3:45
Cyrilix15-Jun-07 3:45 
AnswerRe: Forced scoping as a programming technique? Pin
Nemanja Trifunovic14-Jun-07 6:27
Nemanja Trifunovic14-Jun-07 6:27 
AnswerRe: Forced scoping as a programming technique? Pin
bob1697214-Jun-07 8:12
bob1697214-Jun-07 8:12 
Questionsetting executable icon Pin
R Thompson14-Jun-07 5:44
R Thompson14-Jun-07 5:44 
AnswerRe: setting executable icon Pin
R Thompson14-Jun-07 6:11
R Thompson14-Jun-07 6:11 
AnswerRe: setting executable icon Pin
Michael Dunn14-Jun-07 6:28
sitebuilderMichael Dunn14-Jun-07 6:28 
QuestionRe: setting executable icon Pin
Hamid_RT14-Jun-07 19:44
Hamid_RT14-Jun-07 19:44 
QuestionSave Screenshot Pin
CDRAIN14-Jun-07 4:54
CDRAIN14-Jun-07 4:54 
QuestionRe: Save Screenshot Pin
David Crow14-Jun-07 5:40
David Crow14-Jun-07 5:40 
AnswerRe: Save Screenshot Pin
Naveen14-Jun-07 14:30
Naveen14-Jun-07 14:30 
QuestionRe: Save Screenshot Pin
Hamid_RT14-Jun-07 19:41
Hamid_RT14-Jun-07 19:41 
AnswerRe: Save Screenshot [modified] Pin
CDRAIN15-Jun-07 0:46
CDRAIN15-Jun-07 0:46 
GeneralRe: Save Screenshot Pin
Hamid_RT15-Jun-07 2:56
Hamid_RT15-Jun-07 2:56 

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.