Re: [LIP] Avoid use of global variables
Kumar Appaiah <[email protected]>
| Newsgroups | gmane.user-groups.linux.india.programmers |
|---|---|
| Message-ID | <[email protected]> |
On Thu, Jul 23, 2009 at 08:24:26AM +0530, Saju Pillai wrote: > > My question is, how do I pass on the elements of the command line > > arguments which alter the behaviour of processFile while calling it? > > It seems to me that the easiest way would be to use global variables, > > Yes. > > > but is there an elegant way by which this can be avoided? Or, is it > > acceptable to use global variables in this situation? > > Usually callbacks accept a void *mystuff style context object to solve > this exact problem. Since nftw() doesn't let you pass in a context > object I don't see how you can avoid using globals. > > Also using globals is not a bad thing - particularly in write once, read > many cases. Thanks for the response. I guess this is what I'd have to do. Thanks. Kumar -- Kumar Appaiah ------------------------------------------------------------------------------