Crazy... like a fox. ;) It is actually quite a powerful mechanism for doing repetitious boiler plate code which can have it's maximum change by only changing a define.
Yeah, I do know about that the path is relative. However, if you include a file that is not in the current file's directory, and that file then tries to include your file given the filename that you specified, it won't know where that file is if that file is not located in a path relative to the any of the include directories. Did you get that? :)
Say the include directory set is { /include/path1 }
1 2 3 4 5 6 7 8
|
// FILE: source/path/file.h
#if !defined FILE_H
# define FILE_H
# define INCLUDE_ME "file.h"
# include <includeMe.hpp>
#else
Callback succeeded!
#endif
|
1 2
|
// FILE: /include/path1/includeMe.hpp
#include INCLUDE_ME
|
This won't work, since file.h is not in the set of include paths. If I had set INCLUDE_ME to "source/path/file.h", it still won't work since relative to the include paths it doesn't exist, unless it was located under
/include/path1/source/path/file.h, which for this argument, it does not.
We may be able to remove this completely if all C++ compiles use variadic templates. However, this is a long way off since there are older system around.