I suppose a better description may have helped :)
We use an autotext script that generates our comment block and header guard for .h files based on the filename.
I have run into a situation where two headers in different libraries have the same name (valid in this case) and while I can differentiate the header files themselves due to their location the guards end up being the same so only the first file's content gets handled:
/Core/PlatformSpecifics.h:
/* File header comment */
#ifndef _PlatformSpecifics_h__
#define _PlatformSpecifics_h__
namespace core
{
// Code
}
#endif // _PlatformSpecifics_h__
/UserInterface/PlatformSpecifics.h:
/* File header comment */
#ifndef _PlatformSpecifics_h__
#define _PlatformSpecifics_h__
namespace userinterface
{
// Code
}
#endif // _PlatformSpecifics_h__
In another file:
#include <Core/PlatformSpecifics.h> // Ok, everything gets included
#include <UserInterface/PlatformSpecifics.h> // Broken, guards prevent anything from being included
I want to prefix the project/library name to the file name in guards to prevent this in future. I can obviously do it manually in the couple of cases it may arise, but I'd prefer save myself the pain of tracking down a silly mistake like same-name headers while in deadline groggyness :)
Unfortunately the above solution doesn't quite work in this case. I considered using a GUID macro, but that seems a bit dirty to me.