comp.lang.ada
 help / color / mirror / Atom feed
From: Phil Thornley <phil.jpthornley@gmail.com>
Subject: Re: Question about Spark_IO
Date: Tue, 10 Apr 2012 17:52:12 +0100
Date: 2012-04-10T17:52:12+01:00	[thread overview]
Message-ID: <MPG.29ee756e72e11946989698@news.zen.co.uk> (raw)
In-Reply-To: Cf2dnRYegbnckR_S4p2dnAA@giganews.com

In article <Cf2dnRYegbnckR_S4p2dnAA@giganews.com>, PChapin@vtc.vsc.edu 
says...
> 
> I'm doing something like this to close a file using Spark_IO
> 
>     Spark_IO.Close(Input, Input_Status);
>     if Input_Status /= Spark_IO.Ok then ...
> 
> The Examiner says there is a flow error with the first line because the 
> assignment to Input is "ineffective." This is because it is an 'in out' 
> parameter and nothing is being done with the returned value.
> 
> My understanding is that Close puts the file handle it has been given 
> into an invalid state so that any further use of it will result in an 
> error. Thus it is not correct to do anything with that value after Close 
> returns.
> 
> Is this a case where it is appropriate to suppress the flow error with 
> an '--# accept flow_message...' annotation or is there some better way 
> to handle this situation?

Yes, that's exactly what I would do here.  The File parameter can't be 
changed to 'in' mode - to remove the flow error - as there would be a 
compilation error in the body of Close.

Note that the flow relation on Close doesn't represent the actual flow 
in the procedure and is clearly the closest model that makes any sense.
(It says that the File parameter is set to a constant value - the 
invalid state perhaps - but in the code this setting is conditional on 
the input value of File, so there is actually a self-dependency.)

Cheers,

Phil



  reply	other threads:[~2012-04-10 16:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-08 22:07 Question about Spark_IO Peter C. Chapin
2012-04-10 16:52 ` Phil Thornley [this message]
2012-04-11 14:35 ` Yannick Duchêne (Hibou57)
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox