I've worked with some compilers over 10 years ago which might warrant that kind of rationale. I'm not suggesting it's a good rationale and trying to defend it, but just want to clarify why it might have arisen.
Basically in our case, we tripped up because we had local project headers (for small projects like plugins) named with rather clashy names like simply rect.h
or mem.h
. We thought the use of local-style include directives would protect us from clashes, and it did on most compilers except one we encountered.
I can't remember exactly which compiler tripped us up (I think it was an old version of CodeWarrior, but my memory could be failing me). In any case, this compiler was treating:
#include "rect.h"
... synonymously with:
#include <rect.h>
Basically it made no difference in the former include style that rect.h
was in the exact same directory as the source file including it. It still prioritized searching for header files in the order they appeared in the specified include paths for the project and compiler settings, so we got a lot of clashes there with standard headers and OS headers that we had little choice to resolve except by naming the header files better, less generally, in a less clash-prone way. Maybe we could have tried some other things like:
#include "./rect.h"
... perhaps that would have worked (though it looks a bit goofy). We might have also been able to try to force, through the project and compiler settings, the preprocessor to prioritize the project's own directory above all other include paths. We didn't try exhausting all possible solutions and just went for renaming our header files with a prefix convention we apply consistently to make avoiding conflicts more of a no-brainer without having to analyze things on a case-by-case basis.
This was especially awkward since we were getting it in a third party library outside of our control, and changing such code is pretty gross (ex: we might need to do it again with a new version of the library).
That's all we did. We didn't actually come up with a coding standard suggesting to avoid the former include style in favor of only using the latter, but I can see why someone might establish that rationale in response to a similar compiler issue.
The problem is that if we're targeting multiple platforms and use a wide variety of compilers and sometimes porting to new ones, we unfortunately have to target the lowest common denominator. If that lowest common denominator makes no distinction between #include "rect.h"
and #include <rect.h>
, then the idea that these two are different becomes an illusion on some compilers and a reality on others.
This inconsistency can be a source of confusion, and it might lead to less porting headaches to simply adopt the latter style everywhere to gain back that consistency and perhaps more quickly realize, in foresight rather than in hindsight after looking at a bunch of build errors from trying to port the code, to name headers in a less clashy way.