I wonder why the name after the #ifndef directive is always all caps and don\'t seem to match the name of the actual header file? What are the rules surrounding
The idea is to make sure your header file is only read once during build. The idiom to accomplish that is the structure:
#ifndef _SOME_UNIQUE_NAME
#define _SOME_UNIQUE_NAME
/* The actual header code */
#endif
This means that you should choose a name that you are pretty sure will be unique and is a valid identifier for #ifndef. You should also make sure that the identifier is not used in actual code or confused with a variable or something. Having an upper case tag marks the idiom clearly. Besides that, it is merely conventions not language that dictate that choice. Visual Studio's wizards generates a GUID like identifier for. Sone compilers support #pragma once that have the same effect.