@sbi has already talked about code generation, so let me give you an example.
Say that you have an enumeration of many elements and that you want to create a bunch of functions for each of your elements ...
One solution is to use this multiple inclusion trick.
Then people just use it like this:
#define MY_ENUMERATION_META_FUNCTION(Item_) \ case Item_: return #Item_; char const* print(MyEnum i) { switch(i) { #include "myenumeration.td" } __unreachable__("print"); return 0;
Whether this is good or hacking is up to you, but it is certainly useful not to scan all the functions of the utilities every time a new value is added to the enumeration.
Matthieu M.
source share