comp.lang.ada
 help / color / mirror / Atom feed
From: Jim Rogers <ada_daddy@my-deja.com>
Subject: Re: Message passing code
Date: 1999/06/28
Date: 1999-06-28T00:00:00+00:00	[thread overview]
Message-ID: <7l7sk5$ggl$1@nnrp1.deja.com> (raw)
In-Reply-To: 7l6lni$4a5$1@nnrp1.deja.com

In article <7l6lni$4a5$1@nnrp1.deja.com>,
  Robert Dewar <robert_dewar@my-deja.com> wrote:
> In article <7l0s5k$g32$1@nnrp1.deja.com>,
>   Ted Dennison <dennison@telepath.com> wrote:
>
> > Unless you write them yourself, you don't know how 'Read and
> > 'Write are converting between your objects and stream
> > elements.
>
> I certainly HOPE this is false with any reasonable Ada 95
> compiler. It should be quite transparent what the conversion
> mechanism is. In the case of GNAT, you can look at s-stratt.adb
> which encapsulates the conversions used (we have two versions
> that are standard, and easy to read and understand, one for
> native format, and one which uses XDR for platform
> independence). You can if you like write your own version of
> s-stratt.adb to control the underlying default translations
> that are used.

Unfortunately, I have had some nasty surprises in this area from
ObjectAda.

Example:

   type Byte is mod 2**8;
   for Byte'Size use 8;

I assumed that the native stream representation of the above type
would be represented in 8 bits. In fact it is represented on the
stream in 32 bits. The only way I could assure that this type would
occupy only 8 bits in my stream was to write customized 'Read and 'Write
procedures.

Aonix calls this a feature. They use the Intermetrics front end.
Apparently this is the behavior preferred by Tucker Taft, who insists
that the stream should represent all values by the size of the Base
type, and the Base type for all integer types is Universal Integer.

This is my understanding of the Aonix rationale. I am sure I will be
corrected if I am wrong.

--
Jim Rogers
Colorado Springs, Colorado USA


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.




  reply	other threads:[~1999-06-28  0:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-06-24  0:00 Message passing code David Kristola
1999-06-24  0:00 ` ada_daddy
1999-06-24  0:00   ` Bruce or Tracy
1999-06-25  0:00     ` Jim Rogers
1999-06-25  0:00       ` Bruce or Tracy
1999-06-25  0:00       ` Ted Dennison
1999-06-28  0:00         ` Robert Dewar
1999-06-28  0:00           ` Jim Rogers [this message]
1999-06-24  0:00 ` Dale Stanbrough
1999-06-25  0:00   ` David Kristola
1999-06-25  0:00     ` tmoran
1999-06-25  0:00       ` David Kristola
replies disabled

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