[fpc-devel] "Friend" classes?

Micha Nelissen micha at neli.hopto.org
Fri Mar 25 09:17:53 CET 2005


On Thu, 24 Mar 2005 09:02:30 +0100
DrDiettrich <drdiettrich at compuserve.de> wrote:

> Perhaps you missed that in C/C++ the preprocessor is typically (99.999%)
> used to include header files, not source files. This is comparable to
> Pascal "uses", not to {$Include}!

What's the difference between a 'header' file, and a source file ? Header files often contain template classes with inline implemented methods.

Preprocessor is used also for macros.

Please look again at 'uses', it works on a more abstract level than just recompiling all units depended on, it's where the speed of compiling pascal comes from.

> For the compound Pascal units, the most important *difference* is the
> required implementation of everything, what's declared in the interface
> section of an unit, in the implementation section of the *same* unit.
> This requirement leaves no room for inconsistent sets of interfaces
> (header files) and implementations (source modules).

An advantage, I would say.

> The only *disadvantage* of units are the current Pascal compilers, which
> cannot handle circular unit references :-(

No, it's an advantage: it makes the code and design clearer, plus it increases the speed of compilation a *lot*.

Micha




More information about the fpc-devel mailing list