From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_00,LOTS_OF_MONEY, TO_NO_BRKTS_FROM_MSSP autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,60118c65070501a2 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-09-06 14:47:38 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!feed.textport.net!newsranger.com!www.newsranger.com!not-for-mail Newsgroups: comp.lang.ada From: Ted Dennison References: <3B9797BF.B6FEA4A@worldnet.att.net> <3B97ACBA.26FB053F@worldnet.att.net> Subject: Re: Pool Specific Access Types? Message-ID: X-Abuse-Info: When contacting newsranger.com regarding abuse please X-Abuse-Info: forward the entire news article including headers or X-Abuse-Info: else we will not be able to process your request X-Complaints-To: abuse@newsranger.com NNTP-Posting-Date: Thu, 06 Sep 2001 17:47:30 EDT Organization: http://www.newsranger.com Date: Thu, 06 Sep 2001 21:47:30 GMT Xref: archiver1.google.com comp.lang.ada:12847 Date: 2001-09-06T21:47:30+00:00 List-Id: In article , 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