[fpc-devel] Circular references and forward declarations

Florian Klaempfl florian at freepascal.org
Thu Jan 7 11:04:30 CET 2010


Nikolai ZHUBR schrieb:
> Wednesday, January 06, 2010, 2:47:24 PM, Juha Manninen wrote:
> 
>> On keskiviikko, 6. tammikuuta 2010 13:14:18 Michael Van Canneyt wrote:
> 
>>> Why ? Every class in 1 file is perfectly possible with include files, and 1
>>> big unit file.
> 
>> Ok, include files seem to solve this problem.
>> I don't know why they are not commonly used in Delphi programs as source
> 
> I don't like include files and try to not use them anywhere except
> in some cross-platform libraries, along with conditional compilation,
> and even then, I always try to minimize them.
> 
> An include file by its pure nature is just an arbitary fragment. It
> does not necessarily have any consistent meaning on its own, either
> logically or syntactically. Therefore, compiler does not (and have
> no way to) do any integrity/dependancy checking on include file as
> on a separate entity. For the same reason, looking at an include file
> may give absolutely no idea of its meaning unless you also open all
> its including files along with.
> 
> The concept of include files is not part of the language. It is just
> a tool to mitigate the troubles of editing/storage/archiving and
> such other maintenance burden tasks. From the language perspective,
> include files just do not exist! They are substituted textually, just
> like copy-n-paste, effectively producing one (big or not, whatever)
> file anyway. Period.

Yes. But the same applies to splitting C++ projects in one class per
header/c-file



More information about the fpc-devel mailing list