[fpc-devel] Patches

Hans-Peter Diettrich DrDiettrich1 at aol.com
Fri Oct 1 09:49:16 CEST 2010


Michael Van Canneyt schrieb:

> He meant variables that are not part of an object, but declared as a unit
> variable. If you put all such 'global' variables in 1 unit, you do drag 
> in all the original units, if the variables are typed.

Every external tool has to drag in all the units, that initialize the 
used global variables, regardless of their placement in globals.pas or 
other units. Consequently all global variables should reside in those 
units, that contain their initialization code. Doing so may increase the 
number of units, that have to be used in *all* other units, be internal 
or external, but it would provide the supposed consistency of the unit 
dependencies - automagically, with no need for further considerations or 
discussions.

When ppudump has to use globals.pas, this is a general misdesign. I 
wonder why e.g. pendingstate resides there, when used exclusively by the 
scanner, or init_settings and current_settings, which are meaningful 
only to the compiler and have to be initialized by code somewhere else. 
That's not a problem inside the compiler, which uses all related units, 
but then all global variables for external use should reside in an 
different unit, not in the compiler specific globals unit.

DoDi




More information about the fpc-devel mailing list