|
|
Invisible <voi### [at] devnull> wrote:
> 1. How does it know which files depend on which other files?
If you write an #include line, you create a dependency to that file.
It's that simple.
(In C and C++ there's no difference between source files and header files.
They are just files containing code. You can include anything in anything
else. The compiler (nor the IDE) make any distinction. An automated dependency
tracker simply looks for #included files and creates dependencies based on
that.)
> 2. A header file is what defines what can be accessed from outside a
> given source file.
That's actually just a programming convention. As said, the compiler makes
no distinction between "header" files and "source" files. They are just all
the same.
(Ok, some IDEs support so-called "precompiled headers", but even in those
the distinction is more a question of convention than anything technical.)
> Without a header file, how do you determine what's
> supposed to be public and what isn't?
A header file doesn't really determine what is "public" and what isn't.
It's just a convenience technique. It's easier to put declarations in a
common file and then simply #include that file than to have to write the
declarations in all source files which need them.
--
- Warp
Post a reply to this message
|
|