comp.lang.ada
 help / color / mirror / Atom feed
From: Ding-yuan Sheu <dsheu@afit.af.mil>
Cc: mkanko@afit.af.mil, kshomper@afit.af.mil, lawlis@afit.af.mil,
Subject: C++'s pointer vs Ada's Access type
Date: 1996/07/31
Date: 1996-07-31T00:00:00+00:00	[thread overview]
Message-ID: <31FFD4A6.41C6@afit.af.mil> (raw)


Hello all Ada guru,

	I am doing some C++ programs conversion into Ada95 and I have
a problem in converting C++ pointer into Ada95's access type. I am not
an Ada expert. I hope someone can give me a hand.

	I think C++'s pointer type is basically similar to Ada's access
type. Therefore, for the following C++ declaraction:
	
	int*	ip;  

I convert it into Ada:
	type Integer_Ptr is access all Integer;
	ip : Integer_Ptr;

However, there comes a problem.
In C++, ip can be a pointer that points to a integer array.
Therefore, C++ programmers can do the following initialization:

	int	Array[100];
	ip = &Array;
	for (i:=0;i++,99) { (*ip+i)   = 0; }

My question is how I can do the same thing in Ada by using ip 
to initialize Array instead to directly initialize Array. 

I know my question might be stupid for you Ada experts.
Your comments are preciou to me. Any Help will be appreciated.
Thanks.


	Steven




             reply	other threads:[~1996-07-31  0:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-07-31  0:00 Ding-yuan Sheu [this message]
1996-08-01  0:00 ` C++'s pointer vs Ada's Access type David Weller
1996-08-01  0:00 ` johndoe
1996-08-01  0:00   ` Mark A Biggar
1996-08-01  0:00   ` Bryce Bardin
1996-08-01  0:00   ` Fraser Wilson
replies disabled

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