Re: Pack aspect with aliased component.

Liste des GroupesRevenir à cl ada 
Sujet : Re: Pack aspect with aliased component.
De : spam.jrcarter.not (at) *nospam* spam.acm.org.not (Jeffrey R.Carter)
Groupes : comp.lang.ada
Date : 02. Mar 2025, 12:33:30
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vq1fma$o9gj$1@dont-email.me>
References : 1
User-Agent : Mozilla Thunderbird
On 2025-03-02 10:29, Blady wrote:
 With the following AARM example:
14.e/3          {AI05-0229-1} procedure Q is
                    use P1, P2;
                    type Array1 is array(Integer range <>) of aliased S1
                       with Pack; -- warning: cannot pack aliased components (RM 13.2(7))
 GNAT issues the warning in comment above.
 Why packed type couldn't have aliased components?
This is a warning, not an error. The compiler has accepted the declaration and you can use it.
Remember that Pack is a suggestion to the compiler, not a requirement, and the compiler can ignore it, or pack things less tightly than you might like.
An aliased component may be accessed through an alias (access value), and that access will not know that the component has been packed, and so access memory belonging to other components as well. For this reason, aliased components cannot be packed.
You can specify Component_Size for the type; the compiler must either be able to make the components that size, or reject the declaration. Specifying a Component_Size for an aliased component that makes the component smaller than a stand-alone object of the type will be rejected.
--
Jeff Carter
"I've seen projects fail miserably for blindly
applying the Agile catechism: we're Agile, we
don't need to stop and think, we just go ahead
and code!"
Bertrand Meyer
150

Date Sujet#  Auteur
2 Mar 25 * Pack aspect with aliased component.3Blady
2 Mar 25 `* Re: Pack aspect with aliased component.2Jeffrey R.Carter
6 Mar 25  `- Re: Pack aspect with aliased component.1Blady

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal