Click here to Skip to main content
15,916,293 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionExporting data to mutiple.txt files Pin
ciphus2114-Jun-07 6:08
ciphus2114-Jun-07 6:08 
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 
Well, the problem I'm dealing with is that before I make a function call to say, AddWorkToWorkQueue(), I have to initialize a bunch of pointer variables just to set up this call (which this call will use). AddWorkToWorkQueue, however, is a very dynamic process, and I expect to be able to call it anywhere as much as I want.

Because of this, I do not want to explicitly make this repetitive call in my code -- instead, I define a macro for it, which contains several lines of code. The thing with a macro, is that once you define it, you define it. The variable names you define in a macro do not change, so if you use this macro multiple times, you will get variable redefinitions.

I also want to make this macro easy to use, which means that I don't want the user to be forced to keep track of how many times he has used this macro and pass in an additional number as a token parameter to be concatenated at the end of every variable name (see ## - token pasting preprocessor).

The solution I therefore use, is to enclose my macro with {}, allowing me to initialize all the variables I want without any redefinition.

Note: I did mention in the beginning that I was initializing a bunch of pointer variables. We all know what happens when you go out of scope on pointer variables that have not been deleted -- you get a memory leak. No worries -- I also delete the pointers asynchronously by keeping track of them in an STL container.
GeneralRe: Forced scoping as a programming technique? Pin
jbarton14-Jun-07 8:53
jbarton14-Jun-07 8:53 
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 

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.