The Ada language’s discriminated record type (判别式记录类型) consists of components (元件) called discriminant (判别器) and record components (记录分量) that depend on discriminants.

The discriminant-dependent record components form the variant portion of the record type, i.e., the actual amount of memory occupied by this part of the data depends on the actual value of the discriminant when the variable of that type is declared.

If there are other record components behind a variant of such a record, the offset of those record components in that record is not a constant, but a variable that needs to be calculated.

In the object code generated by the Ada compiler, it can be seen that the object code of the offset calculation is added to the access operations of the subsequent record components in the compiled source code.

When I was reading a large size of software, I saw an example of the above problem. Since the record components behind the variant part are frequently accessed, the additional code and execuating time incurred is considerable.

Therefore, the variation section should be placed at the bottom of the discriminant record type declaration.