[Spark2014-discuss] Not null access constant in SPARK

Hugues Jérôme hugues.jerome at gmail.com
Tue Nov 3 23:01:10 CET 2015


Le 3 nov. 2015 à 22:14, David Lesens <david.lesens at orange.fr> a écrit :

> Indeed, in my case, I am using a pointer to a constant just to avoid
> useless copies of data
> 
> Neither the pointer or the data on which the pointer points can be modified
> 
> So, your "special aspect/pragma" may solve this problem

I’m curious wether Ada 2012 (or even 2005) already has a solution, one can have (as accepted by GPL 2015)
                                
procedure Foo is

   type Bar is not null access constant Integer;

   I1: aliased constant Integer := 10;

   Bar_C : constant Bar := I1'Access;

begin
   null;
end Foo;


I have the felling this match David’s requirement, without need to special pragma. I may be abusing “contant" though
Bar_C is a point that cannot be modified (constant) to a integer that cannot be modified as well (as far as I understand the Ada RM, but I’m not that familiar to those "new" features as I’m restricting myself from using pointers).

Any thoughts ?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.forge.open-do.org/pipermail/spark2014-discuss/attachments/20151103/7e5aa2ed/attachment.html>


More information about the Spark2014-discuss mailing list