The
initialization section is optional. It begins with the reserved word initialization
and continues until the beginning of the finalization section or, if there is
no finalization section, until the end of the unit. The initialization section
contains statements that are executed, in the order in which they appear, on
program start-up. So, for example, if you have defined data structures that
need to be initialized, you can do this in the initialization section.
The initialization sections of units used by a client are executed in the order in which the units appear in the client’s uses clause.
Program structure and syntax:
Overview
Unit structure and syntax: Overview
Unit references and
the uses clause
Multiple and indirect
unit references
Unit structure and syntax: Overview
初始化节是可选的,它以保留字initialization开始一直到结束节开始(如果单元中有结束节)或单元结束(如果单元中没有结束节)。初始化节含有用于执行的语句,当程序开始执行时,将根据初始化节出现的顺序依次执行其语句。例如,如果需要对某些数据结构进行初始化,那么可以将初始化语句置于初始化节。
单元初始化节执行的顺序由使用该单元的单元或程序中决定,即该单元在其客户模块的uses子句中单元列表中的位置决定。
编者注
初始化节中的语句在程序运行开始时执行一次,程序运行中将不再执行。运行中,其它语句也无法将执行点跳转到初始化节中。