comp.lang.ada
 help / color / mirror / Atom feed
From: Ted Dennison<dennison@telepath.com>
Subject: Re: Pool Specific Access Types?
Date: Thu, 06 Sep 2001 21:47:30 GMT
Date: 2001-09-06T21:47:30+00:00	[thread overview]
Message-ID: <S9Sl7.7124$4z.31673@www.newsranger.com> (raw)
In-Reply-To: mqRl7.85388$K6.35118504@news2

In article <mqRl7.85388$K6.35118504@news2>, Wannabe h4x0r says...
>-- This is a file so I can learn how to do pointers in Ada95 --
>-- Try not to laugh too much. I'm a former C junkie, and it shows. --
>
>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 is a 15 character string, and quit is a 1 character string. They will *always*
be different, so you will never go to the else for this "if". You should instead
compare "s(s'first..len) /= quit"

>			while N /= null loop

N starts off null, and nothing reachable ever sets it, so the code inside this
loop won't run either.

Unreachable code:
>					
>			   Put_Line( N.Number'img );
>			   N := N.Next;	   
>			  exit;						
>			end loop;
>		else							

More unreachable code:		
>	            anthr_numb := Integer'value(s(1..len));
>                    N := new Numb_holder'(anthr_numb, N);
>
>		New_Line;
end Unreachable code.

>
>		
>	       end if;
>	end loop;
>
>end Point_pract;

Given this code, I'd expect to see a program that loops endlessly asking for a
number.

---
T.E.D.    homepage   - http://www.telepath.com/dennison/Ted/TED.html
          home email - mailto:dennison@telepath.com



  reply	other threads:[~2001-09-06 21:47 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 [this message]
2001-09-06 22:50         ` Jeffrey Carter
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