comp.lang.ada
 help / color / mirror / Atom feed
From: James Rogers <jimmaureenrogers@worldnet.att.net>
Subject: Re: converting - adasockets
Date: Mon, 11 Jun 2001 15:59:26 GMT
Date: 2001-06-11T15:59:26+00:00	[thread overview]
Message-ID: <3B24EB7A.D2792E53@worldnet.att.net> (raw)
In-Reply-To: 3B24AF5D.241C9743@Physik.Uni-Magdeburg.DE

Gerald Kasner wrote:
> 
> "David C. Hoos, Sr." schrieb:
> >
> > Assuming the following Ada declarations,
> > S : String [1 .. 10];
> 
> This is not an Ada declaration ! (Pascal,Modula-2,Oberon-2...??)
> 
> > I : Integer;
> >
> Why unchecked conversion ?

Unchecked Conversion is necessary because the data is not a string
representation of an integer, but an integer value returned as
a string.  For instance, if the integer is represented as 32 bits,
the string will be returned as a four byte string. Those four bytes
need to be interpreted as an integer instead of as a string.

Ada provides two approaches for solving this problem.

The first is to use unchecked conversion as described by Mr.
Hoos. The second is to define a string and an integer to occupy
the same address. Simply copy the string from Adasockets into
the overlayed string, then read the value as an integer.

The C code example used by the original poster showed the C
equivalent of viewing a string as an integer. There was no conversion
of values as would occur using the 'value attribute.

Jim Rogers
Colorado Springs, Colorado USA



  reply	other threads:[~2001-06-11 15:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-11  6:50 converting - adasockets 
2001-06-11  9:22 ` Gerald Kasner
2001-06-11 10:17 ` David C. Hoos, Sr.
2001-06-11 11:45   ` Gerald Kasner
2001-06-11 15:59     ` James Rogers [this message]
2001-06-11 16:29       ` James Rogers
2001-06-12  1:19         ` Ken Garlington
2001-06-12  4:41           ` James Rogers
2001-06-11 16:33 ` tmoran
2001-06-18 17:13 ` Stephen Leake
replies disabled

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