comp.lang.ada
 help / color / mirror / Atom feed
* Question of data type
@ 2002-03-14  0:59 Bigg K
  2002-03-14  1:13 ` sk
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Bigg K @ 2002-03-14  0:59 UTC (permalink / raw)


I'm using Rational Apex 3.2.0b.  (I don't have a choice in the matter.)

My question:

X is a record.  If I want to assign X'Address to Y, what data type (integer,
float, etc) does Y have to be?

Thanks for your help...



______________________________________________________________________
Posted Via Uncensored-News.Com - Still Only $9.95 - http://www.uncensored-news.com
   With NINE Servers In California And Texas - The Worlds Uncensored News Source
  



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

* Re: Question of data type
  2002-03-14  0:59 Question of data type Bigg K
@ 2002-03-14  1:13 ` sk
  2002-03-14 20:14   ` Marin David Condic
  2002-03-14  1:26 ` tmoran
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: sk @ 2002-03-14  1:13 UTC (permalink / raw)


Hi,

> X is a record.  If I want to assign X'Address to Y, 
> what data type (integer, float, etc) does Y have 
> to be?

Hint : X'Address contains the clue 

Need more ???

Try : System.Address

 o o
  |
 \_/

-- 
-------------------------------------
-- Merge vertically for real address
-------------------------------------
s n p @ t . o
 k i e k c c m
-------------------------------------



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

* Re: Question of data type
  2002-03-14  0:59 Question of data type Bigg K
  2002-03-14  1:13 ` sk
@ 2002-03-14  1:26 ` tmoran
  2002-03-14  2:43 ` Steve Doiel
  2002-03-14  6:31 ` Jeffrey Carter
  3 siblings, 0 replies; 7+ messages in thread
From: tmoran @ 2002-03-14  1:26 UTC (permalink / raw)


> If I want to assign X'Address to Y, what data type does Y have to be?
System.Address   see ARM 13.3(11)



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

* Re: Question of data type
  2002-03-14  0:59 Question of data type Bigg K
  2002-03-14  1:13 ` sk
  2002-03-14  1:26 ` tmoran
@ 2002-03-14  2:43 ` Steve Doiel
  2002-03-14  6:31 ` Jeffrey Carter
  3 siblings, 0 replies; 7+ messages in thread
From: Steve Doiel @ 2002-03-14  2:43 UTC (permalink / raw)


"Bigg K" <bigg_k@mailandnews.com> wrote in message
news:3c8ff5df$1_7@news3.uncensored-news.com...
> I'm using Rational Apex 3.2.0b.  (I don't have a choice in the matter.)
>
> My question:
>
> X is a record.  If I want to assign X'Address to Y, what data type
(integer,
> float, etc) does Y have to be?
>

On the odd chance that you're coming to Ada from the C world, there are (at
least) two possible answers for this question.

The first answer:

  You say that X is a record,  assume that record is of type T.

If you want to have a data type that permits you to reference records of
type T, you can define a new type:

  type TA is access all T;

And then declare an access variable (similar to a typed pointer in C)

  taccess : TA;

In order to permit the value in X to be referenced by an access type you
must declare X as aliased:

  X : aliased T;

Then you can do the assignment

  taccess := X'ACCESS;

The second answer:
If you want to get the equivalent to C's void pointer, the type of the
pointer would be System.Address.  That is

  P : System.Address;

  P := X'Address;

I hope this helps,

SteveD

> Thanks for your help...
>
> ______________________________________________________________________
> Posted Via Uncensored-News.Com - Still Only $9.95 -
http://www.uncensored-news.com
>    With NINE Servers In California And Texas - The Worlds Uncensored News
Source
>





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

* Re: Question of data type
  2002-03-14  0:59 Question of data type Bigg K
                   ` (2 preceding siblings ...)
  2002-03-14  2:43 ` Steve Doiel
@ 2002-03-14  6:31 ` Jeffrey Carter
  2002-03-14 20:17   ` Marin David Condic
  3 siblings, 1 reply; 7+ messages in thread
From: Jeffrey Carter @ 2002-03-14  6:31 UTC (permalink / raw)


Bigg K wrote:
> 
> X is a record.  If I want to assign X'Address to Y, what data type (integer,
> float, etc) does Y have to be?

The type of X is immaterial. The simple answer is, you can't.

I know this is technically the wrong answer, but I've seen so much code
recently that unnecessarily uses addresses that I suspect that this
answer is conceptually correct.

-- 
Jeff Carter
"You tiny-brained wipers of other people's bottoms!"
Monty Python & the Holy Grail



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

* Re: Question of data type
  2002-03-14  1:13 ` sk
@ 2002-03-14 20:14   ` Marin David Condic
  0 siblings, 0 replies; 7+ messages in thread
From: Marin David Condic @ 2002-03-14 20:14 UTC (permalink / raw)


But you might also want to question why you're trying to use the 'Address of
the record in the first place since this is highly uncommon in Ada.
(Typically it would only be done because of interfacing to some hardware or
facilities written in another language.)

MDC
--
Marin David Condic
Senior Software Engineer
Pace Micro Technology Americas    www.pacemicro.com
Enabling the digital revolution
e-Mail:    marin.condic@pacemicro.com
Web:      http://www.mcondic.com/


"sk" <noname@myob.com> wrote in message
news:mailman.1016068442.8821.comp.lang.ada@ada.eu.org...
>
> Hint : X'Address contains the clue
>
> Need more ???
>
> Try : System.Address
>






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

* Re: Question of data type
  2002-03-14  6:31 ` Jeffrey Carter
@ 2002-03-14 20:17   ` Marin David Condic
  0 siblings, 0 replies; 7+ messages in thread
From: Marin David Condic @ 2002-03-14 20:17 UTC (permalink / raw)


Probably the answer is "You shouldn't" :-)

I'd be suspicious that the original poster is trying to do something he
shouldn't as well. I have seen this a lot when a C programmer tries to pass
records as parameters to subroutines.

MDC
--
Marin David Condic
Senior Software Engineer
Pace Micro Technology Americas    www.pacemicro.com
Enabling the digital revolution
e-Mail:    marin.condic@pacemicro.com
Web:      http://www.mcondic.com/


"Jeffrey Carter" <jrcarter@acm.org> wrote in message
news:3C9043C2.D1AB315C@acm.org...
> Bigg K wrote:
> >
> > X is a record.  If I want to assign X'Address to Y, what data type
(integer,
> > float, etc) does Y have to be?
>
> The type of X is immaterial. The simple answer is, you can't.
>
> I know this is technically the wrong answer, but I've seen so much code
> recently that unnecessarily uses addresses that I suspect that this
> answer is conceptually correct.
>
> --
> Jeff Carter
> "You tiny-brained wipers of other people's bottoms!"
> Monty Python & the Holy Grail





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

end of thread, other threads:[~2002-03-14 20:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-14  0:59 Question of data type Bigg K
2002-03-14  1:13 ` sk
2002-03-14 20:14   ` Marin David Condic
2002-03-14  1:26 ` tmoran
2002-03-14  2:43 ` Steve Doiel
2002-03-14  6:31 ` Jeffrey Carter
2002-03-14 20:17   ` Marin David Condic

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