Re: What sense do h files make in c/cpp?
xz wrote:
I am actually switching from Java to C++. And in Java, I don't have
this header file thing.
That is, of course, a major defect of Java. Not that it doesn't
have header files, per se, of course---the C++ solution of
textual inclusion is far from elegant---but that it doesn't have
any means whatsoever of separating the external specification
from the actual code. That makes Java significantly more
difficult to use in larger projects.
That's why I had the question.
Now, my understanding is that h files work as an interface between the
developers of the modules (the corresponding cpp files or the .o
files) and the users of the modules, i.e. the clients.
So they are like manuals and control panels. Basically, you read the h
files to know the usage of the classes and functions, and use them by
dealing with the h files.
Is that correct?
More or less. I'm not sure about "reading the .h files"; on
most of the larger projects I've been on, they've been
automatically generated from the specifications (using Rational
Rose, or something of that sort), and aren't necessarily very
readable. But the .h files do represent a different type of
information, generally created at a different level. (This
isn't totally true, since they have to specify the private
members of the class as well. But with rigorous use of the
compilation firewall idiom...)
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34