comp.lang.ada
 help / color / mirror / Atom feed
* Ask for Access operator
@ 2000-05-05  0:00 carlos
  2000-05-05  0:00 ` Ted Dennison
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: carlos @ 2000-05-05  0:00 UTC (permalink / raw)


I am learning ADA and I am trying to
use a operator similar to '&' operator
of C language. I used 'access but it is
not working for integers. What can I do?




* Sent from AltaVista http://www.altavista.com Where you can also find related Web Pages, Images, Audios, Videos, News, and Shopping.  Smart is Beautiful




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

* Re: Ask for Access operator
  2000-05-05  0:00 Ask for Access operator carlos
@ 2000-05-05  0:00 ` Ted Dennison
  2000-05-07  0:00 ` Pete
  2000-05-09  0:00 ` carlos
  2 siblings, 0 replies; 7+ messages in thread
From: Ted Dennison @ 2000-05-05  0:00 UTC (permalink / raw)


In article <06284168.a35ad676@usw-ex0109-068.remarq.com>,
  carlos <ccaresNOccSPAM@ufro.cl.invalid> wrote:
> I am learning ADA and I am trying to
> use a operator similar to '&' operator
> of C language. I used 'access but it is
> not working for integers. What can I do?

Given your admitted lack of expertise, I think it might be best if you
took a step back told us *why* you want to do that. In C you have to
take the address of variables a lot, due to nasty limitations in the
language. In Ada you very rarely need to do that.

--
T.E.D.

http://www.telepath.com/~dennison/Ted/TED.html


Sent via Deja.com http://www.deja.com/
Before you buy.




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

* Re: Ask for Access operator
  2000-05-05  0:00 Ask for Access operator carlos
  2000-05-05  0:00 ` Ted Dennison
@ 2000-05-07  0:00 ` Pete
  2000-05-07  0:00   ` Robert Dewar
  2000-05-09  0:00 ` carlos
  2 siblings, 1 reply; 7+ messages in thread
From: Pete @ 2000-05-07  0:00 UTC (permalink / raw)


if you are using ada95 try this

type Int_Ptr is access all Integer;
Data : aliased Integer := 5;
I_Ptr : Int_Prt;
I_Ptr := Data'Access

depending on the scope of the variables you may have to use
Data'Unchecked_Access




"carlos" <ccaresNOccSPAM@ufro.cl.invalid> wrote in message
news:06284168.a35ad676@usw-ex0109-068.remarq.com...
> I am learning ADA and I am trying to
> use a operator similar to '&' operator
> of C language. I used 'access but it is
> not working for integers. What can I do?
>
>
>
>
> * Sent from AltaVista http://www.altavista.com Where you can also find
related Web Pages, Images, Audios, Videos, News, and Shopping.  Smart is
Beautiful






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

* Re: Ask for Access operator
  2000-05-07  0:00 ` Pete
@ 2000-05-07  0:00   ` Robert Dewar
  0 siblings, 0 replies; 7+ messages in thread
From: Robert Dewar @ 2000-05-07  0:00 UTC (permalink / raw)


In article <ObhR4.4795$C9.100771@typhoon.nyroc.rr.com>,
  "Pete" <tyrone@nowhere.org> wrote:

> if you are using ada95 try this
>
> type Int_Ptr is access all Integer;
> Data : aliased Integer := 5;
> I_Ptr : Int_Prt;
> I_Ptr := Data'Access

Oh dear! Ted's answer was just spot on here, and I wondered
to him off line if someone would post an answer like the
above.

This is almost CERTAINLY wrong advice. It almost CERTAINLY
leads to writing junk C-in-Ada style code. There are very few
cases in which it is legitimately appropriate to use aliased
variables and the Access operator. When you need these features
they are valuable, but they are also very dangerous because
they encourage a nasty low level style of coding that is
quite familiar to C programmers, but quite inappropriate in
Ada. If you are going to learn Ada, you want to learn how to
write Ada in Ada style. If you want to write C, you might
as well write in C :-)

I must say that I see huge overuse of 'Access and aliased in
a lot of Ada95 code.


Sent via Deja.com http://www.deja.com/
Before you buy.




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

* Re: Ask for Access operator
  2000-05-05  0:00 Ask for Access operator carlos
  2000-05-05  0:00 ` Ted Dennison
  2000-05-07  0:00 ` Pete
@ 2000-05-09  0:00 ` carlos
  2000-05-09  0:00   ` Robert Dewar
  2000-05-09  0:00   ` Ted Dennison
  2 siblings, 2 replies; 7+ messages in thread
From: carlos @ 2000-05-09  0:00 UTC (permalink / raw)



I really appreciate all answers
given here. I am doing just some
specific language contrasts and
all your opinions means a help


thanks a lot


* Sent from AltaVista http://www.altavista.com Where you can also find related Web Pages, Images, Audios, Videos, News, and Shopping.  Smart is Beautiful




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

* Re: Ask for Access operator
  2000-05-09  0:00 ` carlos
@ 2000-05-09  0:00   ` Robert Dewar
  2000-05-09  0:00   ` Ted Dennison
  1 sibling, 0 replies; 7+ messages in thread
From: Robert Dewar @ 2000-05-09  0:00 UTC (permalink / raw)


In article <27c7f3b0.6787226b@usw-ex0109-068.remarq.com>,
  carlos <ccaresNOccSPAM@ufro.cl.invalid> wrote:
>
> I really appreciate all answers
> given here. I am doing just some
> specific language contrasts and
> all your opinions means a help


Then contrast high level capabilities, not low level features,
or you will get a completely distorted viewpoint.


Sent via Deja.com http://www.deja.com/
Before you buy.




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

* Re: Ask for Access operator
  2000-05-09  0:00 ` carlos
  2000-05-09  0:00   ` Robert Dewar
@ 2000-05-09  0:00   ` Ted Dennison
  1 sibling, 0 replies; 7+ messages in thread
From: Ted Dennison @ 2000-05-09  0:00 UTC (permalink / raw)


In article <27c7f3b0.6787226b@usw-ex0109-068.remarq.com>,
  carlos <ccaresNOccSPAM@ufro.cl.invalid> wrote:
>
> I really appreciate all answers
> given here. I am doing just some
> specific language contrasts and
> all your opinions means a help

All the more reason for you to tell us exactly what kind of thing you
are trying to do. Ada will compare very badly if you try to implement C
problem-solving techniques directly in Ada. Far better would be to
compare Ada techniques vs. C (or language X) techniques.

Being (presumably) a non-native English speaker yourself, surely you can
understand this. If you were to just write down what you wanted to say
in your native toungue (Spanish?), then try to translate every single
word you wrote into English one at a time, the result would not make
much sense at all to me.

--
T.E.D.

http://www.telepath.com/~dennison/Ted/TED.html


Sent via Deja.com http://www.deja.com/
Before you buy.




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

end of thread, other threads:[~2000-05-09  0:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-05-05  0:00 Ask for Access operator carlos
2000-05-05  0:00 ` Ted Dennison
2000-05-07  0:00 ` Pete
2000-05-07  0:00   ` Robert Dewar
2000-05-09  0:00 ` carlos
2000-05-09  0:00   ` Robert Dewar
2000-05-09  0:00   ` Ted Dennison

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