I have a question about using #undefto override macros.
I have a file global.hthat contains several # define-d macros. In the code that uses these macros, I find that the values that the macros hold are not universal enough. I want to redefine macros to make them more universal. I wrote the following code snippet to do just that:
std::cout << endl << "Enter pitch threshold:" << endl;
std::cin >> pitchT;
#ifdef PitchThreshold
#undef PitchThreshold
#define PitchThreshold pitchT
#endif
My questions:
Does using #undef in this way redefine the macro in all source files or locally for the function in which the above lines of code are written? What is the scope of the #undef and #define statements?
What can I do (other than changing the macros in the file, where they are # define-d), to ensure that the macro definitions are changed in all the source files?
Thanks,
Sriram
source
share