in reply to Re: Solved: splitting source file
in thread Solved: splitting source file

Toolset maybe intented to be used at least some of this kind of situations. But what makes including not safe? I understand that trying to modify source by filtering is a hazardous operation but including a file does not modify the original source. It is just like a "symbol" which expands to something else. There seems to be practically no performance hit because the whole file is included in a single operation during the compilation phase without looping at all.

Replies are listed 'Best First'.
Re^3: Solved: splitting source file
by chromatic (Archbishop) on Feb 23, 2010 at 18:56 UTC
    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.