Re: [OT] What is a 'header' file?
Matt Lewis wrote:
>
> Derek Parnell wrote:
> >
> > ZNorQ wrote:
> > >
> > > I'm not quite sure what a header file is.
> >
> > Header files are used by the C and C++ languages.
>
> <snip>
>
> > Then, when the compiler comes across a reference to an object of the class
> > 'Bar',
> > it knows enough to check that the reference is valid.
> >
> > Header files are useful for single pass compilers because it means that it
> > can
> > deal easily with forward references.
> >
> > Header files are not needed for multiple pass compilers.
>
> Yeah, but it's a bit more than that, because to build a C/C++ executable,
> compiling isn't enough. Basically, the compiler compiles each .c/cpp/etc
> file into an object file, then it links them all together. Before the
> linking,
> none of the object files really know about each other, except from what
> they've heard from header files. Some of the references might also be
> resolved to dynamic/shared libraries.
>
> Matt
Also, C header files help us to follow the "Don't Repeat Yourself" principle:
they can contain in one place symbols and macros declarations used by several
modules which form the program. Thus, the software creation and the software
maintenance is facilitated.
- Fernando
|
Not Categorized, Please Help
|
|