comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <jeffrey.carter@boeing.com>
Subject: Re: Pool Specific Access Types?
Date: Thu, 6 Sep 2001 22:50:23 GMT
Date: 2001-09-06T22:50:23+00:00	[thread overview]
Message-ID: <3B97FDAF.3DDCD98@boeing.com> (raw)
In-Reply-To: mqRl7.85388$K6.35118504@news2

Wannabe h4x0r wrote:
> 
> with Ada.Text_IO; use Ada.Text_IO;
> 
> procedure Point_pract is
> 
>         type Numb_holder;
>         type Numb_ptr is access Numb_holder;
> 
>         type Numb_holder is
>                 record
>                   Number: Integer;
>                   Next:   Numb_Ptr;
>                 end record;
> 
>         N: Numb_ptr;
> 
>         s : string(1..15);
>         len : natural;
>         quit : constant String := "q";
> 
>         anthr_numb : integer := 0;
> 
> begin
> 
>         loop
>                 Put_Line("Enter a number here: ");
>                 Get_Line( s , len);
>                 if s /= quit then

S will never be equal to Quit. S'Length is 15, and Quit'Length is 1.

>                         while N /= null loop
> 
>                            Put_Line( N.Number'img );
>                            N := N.Next;
>                           exit;
>                         end loop;

This appears to be what you want to do when S = Quit. Is the test in
your "if" wrong?

>                 else
>                     anthr_numb := Integer'value(s(1..len));

This is what you do if S = Quit, which is never true. However, if it
were true, this call to Integer'Value would raise an exception, since S
(S'First .. Len) does not contain the textual representation of an
Integer.

>                     N := new Numb_holder'(anthr_numb, N);
> 
>                 New_Line;
> 
> 
>                end if;
>         end loop;
> 
> end Point_pract;


-- 
Jeffrey Carter



  parent reply	other threads:[~2001-09-06 22:50 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-06 14:12 Pool Specific Access Types? Mr.Clueless
2001-09-06 15:07 ` Ted Dennison
2001-09-06 15:36   ` Mr.Clueless
2001-09-06 15:35 ` James Rogers
2001-09-06 15:54   ` Mr.Clueless
2001-09-06 17:04     ` James Rogers
2001-09-06 20:56       ` Wannabe h4x0r
2001-09-06 21:47         ` Ted Dennison
2001-09-06 22:50         ` Jeffrey Carter [this message]
2001-09-06 21:06       ` Pool Specific Access Types? Screw up in the previous post Clueless
2001-09-06 17:06     ` Pool Specific Access Types? Stephen Leake
2001-09-06 22:24   ` Pool Specific Access Types? Thanks Ted...everyone Clueless
2001-09-06 16:55 ` Pool Specific Access Types? Darren New
2001-09-06 17:03   ` Ted Dennison
2001-09-06 17:19     ` Warren W. Gay VE3WWG
2001-09-06 18:55     ` Darren New
replies disabled

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