* Parameter return when exceptions occur
@ 2004-10-29 3:02 Steve
2004-10-29 8:20 ` Martin Dowie
0 siblings, 1 reply; 7+ messages in thread
From: Steve @ 2004-10-29 3:02 UTC (permalink / raw)
The "variable lenght strings thread" has touched on the case of using
Ada.Text_Io.Get_Line with a string on the last line of a file that does not
contain a file terminator. In this case an End_Error exception is raised.
Question: when the End_Error exception occurs, is anything known about the
value of the parameters to Get_Line? Does the procedure still return
meaningful values?
I suspect it is compiler dependent, since I didn't manage to find any
explanation in the LRM.
Steve
(The Duck)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Parameter return when exceptions occur
2004-10-29 3:02 Parameter return when exceptions occur Steve
@ 2004-10-29 8:20 ` Martin Dowie
2004-10-31 14:47 ` Matthew Heaney
0 siblings, 1 reply; 7+ messages in thread
From: Martin Dowie @ 2004-10-29 8:20 UTC (permalink / raw)
Steve wrote:
> The "variable lenght strings thread" has touched on the case of using
> Ada.Text_Io.Get_Line with a string on the last line of a file that
> does not contain a file terminator. In this case an End_Error
> exception is raised.
>
> Question: when the End_Error exception occurs, is anything known
> about the value of the parameters to Get_Line? Does the procedure
> still return meaningful values?
>
> I suspect it is compiler dependent, since I didn't manage to find any
> explanation in the LRM.
If a subprogram raises an exception you can assume /nothing/ about
the contents of the returning values.
Cheers
-- Martin
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Parameter return when exceptions occur
@ 2004-10-29 8:41 Christoph Karl Walter Grein
2004-10-29 8:59 ` Martin Dowie
0 siblings, 1 reply; 7+ messages in thread
From: Christoph Karl Walter Grein @ 2004-10-29 8:41 UTC (permalink / raw)
To: comp.lang.ada
> > Question: when the End_Error exception occurs, is anything known
> > about the value of the parameters to Get_Line? Does the procedure
> > still return meaningful values?
> >
> > I suspect it is compiler dependent, since I didn't manage to find any
> > explanation in the LRM.
>
> If a subprogram raises an exception you can assume /nothing/ about
> the contents of the returning values.
In fact, there even isn't a returned value since you "return" to a different place:
the exception handler (if any).
__________________________________________________________
Mit WEB.DE FreePhone mit hoechster Qualitaet ab 0 Ct./Min.
weltweit telefonieren! http://freephone.web.de/?mc=021201
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Parameter return when exceptions occur
2004-10-29 8:41 Christoph Karl Walter Grein
@ 2004-10-29 8:59 ` Martin Dowie
0 siblings, 0 replies; 7+ messages in thread
From: Martin Dowie @ 2004-10-29 8:59 UTC (permalink / raw)
Christoph Karl Walter Grein wrote:
>>> Question: when the End_Error exception occurs, is anything known
>>> about the value of the parameters to Get_Line? Does the procedure
>>> still return meaningful values?
>>>
>>> I suspect it is compiler dependent, since I didn't manage to find
>>> any explanation in the LRM.
>>
>> If a subprogram raises an exception you can assume /nothing/ about
>> the contents of the returning values.
>
> In fact, there even isn't a returned value since you "return" to a
> different place: the exception handler (if any).
The parameters used in the call might still be in scope though - but you
can't assume anything about their contents.
Cheers
-- Martin
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Parameter return when exceptions occur
2004-10-29 8:20 ` Martin Dowie
@ 2004-10-31 14:47 ` Matthew Heaney
2004-11-01 1:19 ` Steve
0 siblings, 1 reply; 7+ messages in thread
From: Matthew Heaney @ 2004-10-31 14:47 UTC (permalink / raw)
"Martin Dowie" <martin.dowie@baesystems.com> writes:
> If a subprogram raises an exception you can assume /nothing/ about the
> contents of the returning values.
This is only true if this is a pass-by-copy type (scalar, etc). If the
type is pass-by-reference (tagged, etc), then yes, you can depend on the
values "returned" by the subprogram, even when there's an exception.
(In fact, the AI-302 containers depend on this behavior.)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Parameter return when exceptions occur
2004-10-31 14:47 ` Matthew Heaney
@ 2004-11-01 1:19 ` Steve
2004-11-01 4:11 ` Jeffrey Carter
0 siblings, 1 reply; 7+ messages in thread
From: Steve @ 2004-11-01 1:19 UTC (permalink / raw)
It would be nice if Text_Io.Get_Line would work this way and return a count
and string when an end error exception occurs. I think it actually works
with some compilers.
Steve
(The Duck)
"Matthew Heaney" <matthewjheaney@earthlink.net> wrote in message
news:u654rj65p.fsf@earthlink.net...
> "Martin Dowie" <martin.dowie@baesystems.com> writes:
>
> > If a subprogram raises an exception you can assume /nothing/ about the
> > contents of the returning values.
>
> This is only true if this is a pass-by-copy type (scalar, etc). If the
> type is pass-by-reference (tagged, etc), then yes, you can depend on the
> values "returned" by the subprogram, even when there's an exception.
> (In fact, the AI-302 containers depend on this behavior.)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Parameter return when exceptions occur
2004-11-01 1:19 ` Steve
@ 2004-11-01 4:11 ` Jeffrey Carter
0 siblings, 0 replies; 7+ messages in thread
From: Jeffrey Carter @ 2004-11-01 4:11 UTC (permalink / raw)
Steve wrote:
> It would be nice if Text_Io.Get_Line would work this way and return a
> count and string when an end error exception occurs. I think it
> actually works with some compilers.
Neither of these are pass-by-reference parameters. Last is a
pass-by-copy parameter, and Item is a pass-however-the-compiler-chooses
parameter.
--
Jeff Carter
"We use a large, vibrating egg."
Annie Hall
44
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2004-11-01 4:11 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-29 3:02 Parameter return when exceptions occur Steve
2004-10-29 8:20 ` Martin Dowie
2004-10-31 14:47 ` Matthew Heaney
2004-11-01 1:19 ` Steve
2004-11-01 4:11 ` Jeffrey Carter
-- strict thread matches above, loose matches on Subject: below --
2004-10-29 8:41 Christoph Karl Walter Grein
2004-10-29 8:59 ` Martin Dowie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox