comp.lang.ada
 help / color / mirror / Atom feed
From: "Gino POLIDO" <gino.polido@wanadoo.fr>
Subject: Re: enumeration_io: get error
Date: Sun, 16 Jun 2002 01:10:47 +0200
Date: 2002-06-15T23:08:52+00:00	[thread overview]
Message-ID: <aeghe4$s5a$1@wanadoo.fr> (raw)
In-Reply-To: B9310B38.43F6%R_Tim_Coslet@pacbell.net

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2151 bytes --]

Ok.
But the problem is, if I enter something like 'm' or 'y' (it's outside de
type Mytype is (a,b,c)), the data_error exception is raised one time by the
get, then tests is recursively called. So  I have to enter again something.

But if I enter something like '*','%','/' instead of a letter like 'm', the
Data_Error is raised and tests is recursively called again and again until
storage_error and stack overflow. It doesn't stop!!!

Thks!

"R. Tim Coslet" <R_Tim_Coslet@pacbell.net> a �crit dans le message de news:
B9310B38.43F6%R_Tim_Coslet@pacbell.net...
> You are getting Storage_Error, because your exception handler (which is
> handling the Data_Error exception raised by the get when something outside
> the type is entered) is recursively calling tests. When you have done this
> enough the stack overflows...
>
> One way to handle this would be to use the "goto" in the handler, so that
> the program iterates rather than recurses. However many people consider
> "goto" as bad style. A "loop" can also be used, but I'll leave it up to
you
> to figure it out.
>
> --
>         R. Tim Coslet
>         r_tim_coslet@pacbell.net
>
> Technology, n. Domesticated natural phenomena.
>
>
> > From: "Gino POLIDO" <gino.polido@wanadoo.fr>
> > Organization: Wanadoo, l'internet avec France Telecom
> > Newsgroups: comp.lang.ada
> > Date: Sat, 15 Jun 2002 23:06:16 +0200
> > Subject: enumeration_io: get error
> >
> > Look at this. If you get "*" or another no alpha numeric character,
there is
> > a loop and it raises a storagr_error.
> > How to do?
> >
> > Thks
> >
> > ---------------------------------
> > package Mytype is
> >
> > type Tmytype is (a,b,c);
> >
> > end Mytype;
> >
> > with Mytype;
> > with ada.text_io;
> >
> > package Enumeration_Tmytype is new
> > ada.text_io.enumeration_io(Mytype.Tmytype);
> >
> > with Mytype;
> > with Enumeration_Tmytype;
> > with ada.text_io;
> >
> > procedure tests is
> > input:Mytype.Tmytype;
> > begin
> > for i in 1..4 loop
> > ada.text_io.put("Choose(a,b, or c):");
> > enumeration_Tmytype.get(input);
> > end loop;
> >
> > exception
> > when others =>
> > tests;
> > end tests;
> >
> >
> >
>





  reply	other threads:[~2002-06-15 23:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-15 21:06 enumeration_io: get error Gino POLIDO
2002-06-15 22:26 ` R. Tim Coslet
2002-06-15 23:10   ` Gino POLIDO [this message]
2002-06-15 23:54 ` sk
     [not found] ` <3D0BD39B.FED8A0E4@myob.com>
2002-06-16  0:00   ` sk
2002-06-16  2:12 ` Jeffrey Carter
2002-06-16 19:59   ` sk
replies disabled

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