comp.lang.ada
 help / color / mirror / Atom feed
* Pool Specific Access Types?
@ 2001-09-06 14:12 Mr.Clueless
  2001-09-06 15:07 ` Ted Dennison
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Mr.Clueless @ 2001-09-06 14:12 UTC (permalink / raw)


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;

I get an error in s-valuns at line 85.  Note I'm using the above code
segment that I found in  the Barnes book. This is a Constraint Error that
pops up at runtime and terminates the program. I suspect I'm not passing
data to or reading data from the List correctly, but I'm following the
examples in the book by wrote.

Any advice would help. Note, I am using Ada.Text_IO so as to pull the
Integers in off a text  string entered by the user at runtime.

Thanks.

Clueless. 
chris@dont.spam.me



^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2001-09-06 22:50 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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