From: Alexander Senier <mail@senier.net>
Subject: Re: Question about out parameters of unconstrained array type.
Date: Sun, 26 Feb 2012 13:25:32 +0100
Date: 2012-02-26T13:25:32+01:00 [thread overview]
Message-ID: <20120226132532.7fb8ec1b@t60> (raw)
In-Reply-To: MPG.29b4086bef3313be98968b@news.zen.co.uk
On Sun, 26 Feb 2012 09:14:53 -0000
Phil Thornley <phil.jpthornley@gmail.com> wrote:
> For your code above, if the cost of including the initialization of the
> array is too high then the easiest way to remove the the error is
> probably to add another parameter that is the length of the Description
> string. Using Alexander's code:
Can anybody comment on the legality of using attributes of an out parameter of
an unconstrained (array) type in Ada? A brief skim through LRM could not
enlighten me...
If using 'Length (and other attributes) elsewhere than in a loop constraint
actually is legal Ada, than this seems like an unnecessary limitation of SPARK
that should be relaxed. For now, I would prefer accepting the resulting flow
error for several reasons:
* Default initialization may hide subsequent flow errors that would
been spotted by the flow analysis otherwise (the coarse grained treatment
of array makes that less important, though)
* As Phil said, (additional) default initialization may impose a significant
performance overhead
* Passing in the upper bound of the array as a parameter IMHO makes the code
less intuitive and readable than it could be - just to silence the flow
analysis ;-(
Regards
Alex
next prev parent reply other threads:[~2012-02-26 12:25 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-25 15:19 Question about out parameters of unconstrained array type Peter C. Chapin
2012-02-25 15:33 ` Dmitry A. Kazakov
2012-02-25 18:20 ` Phil Thornley
2012-02-25 20:01 ` Simon Wright
2012-02-25 22:44 ` Phil Thornley
2012-02-27 13:48 ` Mark Lorenzen
2012-02-27 15:32 ` Phil Thornley
2012-02-25 23:37 ` Alexander Senier
2012-02-26 1:16 ` Peter C. Chapin
2012-02-26 9:14 ` Phil Thornley
2012-02-26 12:25 ` Alexander Senier [this message]
2012-02-26 13:20 ` Phil Thornley
2012-02-26 14:25 ` Niklas Holsti
2012-02-26 17:32 ` Jeffrey Carter
2012-02-26 15:29 ` Peter C. Chapin
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox