J
James Kanze
* Juha Nieminen:
The cost of treating .h headers as C++, if there is such a
cost, is so low that e.g. I, or Victor, have not even noticed
any such cost at all.
And it has been pointed out that this not always the case.
There are situations (e.g. mixed C and C++) where there is a
cost. (In a pure C++ environemnt, the cost of treating .ada
files as C++ headers is also so low you'd never notice it.)
But the cost, insignificant as it is, does not matter anyway
because we derive a lot of benefits from treating .h as C++.
Such as confusing some readers, who come from other
environments?
Especially considering the very large number of libraries with
C++ .h headers. Boost is a fairly unique exception.
Along with the pre-standard implementations of the standard
librarys, e.g. <iostream.hpp>. IMHO, that pretty much set the
tone.
As a general rule, an experienced programmer will have no real
problems, regardless of the conventions in force where he works
(and such conventions often define several extensions, e.g. .tcc
for template implementation code). For a beginner, who may
later have to work in mixed language projects, it's better if he
avoid .h, since that will create confusion as soon as any C is
present (e.g. <windows.h>, <unistd.h>, etc.).