Re: Converting Type Characters to type string
- From: "Dmitry A. Kazakov" <mailbox@xxxxxxxxxxxxxxxxx>
- Date: Mon, 31 Mar 2008 11:59:30 +0200
On Mon, 31 Mar 2008 01:54:24 -0700 (PDT), Ludovic Brenta wrote:
As a matter of general principle, I always use a for loop when
traversing an array:
procedure Get_Digits (Result : out String; Last : out Natural);
-- Reads at most Result'Length characters from standard input. Stops
-- after the first character that is not a decimal digit.
-- On output, Result (Result'First .. Last) contains the digits from stdin;
-- Last may be zero, indicating no digits entered (i.e. one character that
-- is not a digit was read).
(or none, on End_Error, Data_Error etc)
Such Get_Digits is not composable, without a sort of "unget," which
Ada.Text_IO does not have.
I believe it was a bad (FORTRAN?) idea to intermix I/O with parsing /
syntax analysis. Though it had one theoretical advantage of being able to
deal with lines of an unlimited length, in real life that never worked
anyway. (Like in your example, it would not).
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
.
- Follow-Ups:
- Re: Converting Type Characters to type string
- From: Jean-Pierre Rosen
- Re: Converting Type Characters to type string
- References:
- Re: Converting Type Characters to type string
- From: george . priv
- Re: Converting Type Characters to type string
- From: tmoran
- Re: Converting Type Characters to type string
- From: Ludovic Brenta
- Re: Converting Type Characters to type string
- Prev by Date: Re: Converting Type Characters to type string
- Next by Date: Re: Converting Type Characters to type string
- Previous by thread: Re: Converting Type Characters to type string
- Next by thread: Re: Converting Type Characters to type string
- Index(es):
Relevant Pages
|