Version 1.1 of ais/ai-00161.txt

Unformatted version of ais/ai-00161.txt version 1.1
Other versions for file ais/ai-00161.txt

!standard 10.02.01 (09)          96-09-10 AI95-00161/00
!class confirmation 96-09-10
!status received 96-09-10
!priority Medium
!difficulty Medium
!subject Default-initialized objects
!summary 96-09-10
!question 96-09-10
!response 96-09-10

!section 10.2.1(9)
!subject Default-initialized objects
!reference RM95-10.2.1(9)
!from Pascal Leroy 96-08-30
!reference 96-5697.a Pascal Leroy 96-9-10>>

The referenced paragraph says that a construct is not preelaborable if it
performs "The creation of a default-initialized object (including a component)
of a descendant of a private type, private extension, controlled type, task
type or protected type with entry declarations;"

In this rule, what is the meaning of "default-initialized object"?  I couldn't
find a definition of this phrase.

Bob Duff (private communication) tells me that this phrase is intended to
cover (among other things?) an object declaration which doesn't have an
initialization expression.

Even accepting this interpretation, there remain open questions.  For
instance: is an object to which a pragma Import is applied a
default-initialized object?  B.1(38) and B.1(24) say that no initialization
occurs in this case, so it would seem that the answer is 'no'.

It is interesting to note that, with this interpretation, 10.2.1(9) becomes
very restrictive: for a private type, a private extension or a controlled
type, I am not sure how one could write an initial value without either
referencing the name of an object, calling a non-static function, or writing
an extension aggregate.  But these things are forbidden by 10.2.1(7-9).  So
10.2.1 seems to state that (except in the case of imported objects) a
preelaborable units can never declare an object of a private type, a private
extension, or a controlled type.  Is it the intent?

(It looks like all objects of task or protected types are
"default-initialized", so the rule is redundant.  But that's not important: it
is clear that we don't want objects of such types in preelaborated units.)


Questions? Ask the ACAA Technical Agent