comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@merv.cs.nyu.edu (Robert Dewar)
Subject: Re: GNAT's internal format for Discriminant Records?
Date: 1998/06/21
Date: 1998-06-21T00:00:00+00:00	[thread overview]
Message-ID: <dewar.898441045@merv> (raw)
In-Reply-To: 6meah3$3b$1@cronkite.sp.trw.com


Rich said

<<We're trying to do some fixed format record layouts and are
looking into using discriminants.. These record formats will be
used to send data to hardware boxes, so the overhead of
what Ada might add when using some of the slick OO features
of the language are being checked into.  Now, we've already
found that GNAT (3.10p under Solaris 2.6) adds the size of the
discriminant to the overall record size (i.e. if the discriminant is
4 bits, then 4 bits are added to the overall record size).  We
tried the same under GHS Adamulti (1.8.8D) and found that it
did NOT add that overhead.  Now, for a few reasons, it would
appear that if there are multiple platforms/compilers involved
perhaps the use of discriminants should be avoided -- am I
correct in this theory?
>>


You can only assume that data is transferable between implementations
if the layout is fully specified by rep clauses, and generally this
may not be possible, e.g. for tagged types. Certainly the tag itself
will NOT be transferrable in practice in any case. Variant records
should be no problem, since you can specify the location of every
field including the discriminants. It seems most strange for a 
compiler to NOT include the discriminants in values of the type (this
is the normal implementation approach).

But I think that the whole idea of trying to interchange data at this
level is flawed for anything as complex as tagged types and variant
records. It is usually better to use a higher level approach, e.g.
use streams with your own stream read/write routines defined.

If you are using GNAT on multiple platforms, you can use GLADE (our
annex E Distributed Systems implementation), to implement heterogenous
distributed applications using XDR for data interchange.

Robert Dewar
Ada Core Technologies





      parent reply	other threads:[~1998-06-21  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-06-19  0:00 GNAT's internal format for Discriminant Records? Rick Flower
1998-06-19  0:00 ` Simon Wright
1998-06-20  0:00 ` Tom Moran
1998-06-21  0:00   ` Robert Dewar
1998-06-21  0:00 ` Robert Dewar [this message]
replies disabled

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