But what makes including not safe?
You end up compiling and running modified source code.
I understand that trying to modify source by filtering is a hazardous operation but including a file does not modify the original source.
Technically correct, but you're not running the original source code. You're running the modified source code. (If you weren't modifying the source code and running that, your code wouldn't work, because its sole purpose is to modify the source code you actually run.)
I'm not telling you not to use this, but I am telling you that I believe David's solution already exists, is already tested, and uses a less fragile technique.
|