The rule in C against declaring a struct's members more than once seems to me to be the main reason that include guards are necessary. If we have the following in "header.h":
struct s {
int a;
char b;
};
and the file "a.h" #include's header.h, then we cannot include both "a.h" and "header.h" as then struct s is defined twice.
My question is, what is the problem with doing this? Why can't multiple identical definitions of structs be allowed? This would remove the need for include guards, and clean up C header files enormously.
The rule in C is that multiple declarations are allowed, but only one definition. For some reason, specifying the members of a struct is called "definition", even though it is not defining a variable or a function.