comp.lang.ada
 help / color / mirror / Atom feed
From: "Mr.Clueless" <chris@dont.spam.me>
Subject: Re: Pool Specific Access Types?
Date: Thu, 06 Sep 2001 15:54:30 GMT
Date: 2001-09-06T15:54:30+00:00	[thread overview]
Message-ID: <W_Ml7.84624$K6.34941280@news2> (raw)
In-Reply-To: 3B9797BF.B6FEA4A@worldnet.att.net

In article <3B9797BF.B6FEA4A@worldnet.att.net>, James Rogers
<jimmaureenrogers@worldnet.att.net> wrote:

> Could the problem be that your record is defined with two fields:
> The_Numb and Next, while your loop is accessing two fields: Value and
> Next? You also have your access type defined as Numb_pnt while your Next
> field is defined as being type Numb_pt.
> 
> I suspect these are typos in your posting and not in your code. It would
> be easier to diagnose the problem without such errors.
> 
> Jim Rogers Colorado Springs, Colorado USA
> 
> "Mr.Clueless" wrote:
>> 
>> Alright...I'm creating an access type like this...
>> 
>> type Number;
>> 
>> type Numb_pnt is access Number;
>> 
>> type Number is
>>        record
>>           The_Numb: Integer;
>>            Next: Numb_pt;
>>         end record;
>> 
>>         N: Numb_pnt;
>> 
>> Now I know I got that part right...but I'm running into a problem in
>> reading and assigning  numbers (or any other kind of data) from/to the
>> linked list.
>> 
>> For example, I'll assign a new value from a variable like this...
>> 
>>         N := new Number'(<variable>, N);
>> 
>> which seems to work alright.  But then when I try to read from it using
>> a procedure such as...
>> 
>>         function Sum(List: Cell_Ptr) return Integer is
>>            Local: Cell_Ptr := List; S: Integer := 0;
>>         begin
>>                 while Local /= null loop
>>                   S := S + Local.Value; Local := Local.Next;
>>                  end loop;
>>                 return S;
>>         end Sum;


Your right, it is a typo.  Should read...

function Sum(List: Numb_ptr) return Integer is
	Local : Numb_ptr := List;  S : Inter := 0;
begin
	while Local /= null loop
		S := S + Local.The_Numb; Local := Local.Next;
	end loop; return S;
end Sum;

Also, I'm not sure how accessing two fields in a loop would cause an
error. I can possibly see issues with regards to scope, but it's a little
fuzzy. Perhaps a nested loop, one accessing the "The_Numb" value and the
other accessing the "Next" value would do it?

Clueless chris@dont.spam.me



  reply	other threads:[~2001-09-06 15:54 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 [this message]
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
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