I don't know whether I should be proud or ashamed to say that I've never in my whole life needed to use #undef - until today. but what is the 'scope' of a #undef statement (i.e. how long does it last for, if it appears in a source file, as distinct from a header file?)

Let's say I'm compiling a project with twenty cpp source files. I have a preprocessor definition - let's say, #define MY_DEFINE "Hello World" which I've set up in my IDE.

In module 5 (out of the twenty modules) I need to #undef MY_DEFINE for some reason. Is it then #undef'd until the compiler finishes compiling or is it only #undef'd for that one source file?

In other words, when the compiler reaches the 6th source file, will it re-establish #define MY_DEFINE "Hello World"