comp.lang.ada
 help / color / mirror / Atom feed
* Re: fixed point type over an interface.
@ 1997-02-12  0:00 W. Wesley Groleau (Wes)
  1997-02-12  0:00 ` Robert Dewar
  1997-02-12  0:00 ` Robert Dewar
  0 siblings, 2 replies; 3+ messages in thread
From: W. Wesley Groleau (Wes) @ 1997-02-12  0:00 UTC (permalink / raw)



Matthew Heaney recommended using a rep-spec'ed type for the interface and
converting to/from a local type at each end.

If you are using Ada-83, I know of at least one compiler where a rep-spec
on 'Small cannot be trusted.  This compiler always uses a multiple of
four bits for the fractional part, and for the integer part, uses the
smallest multiple of four bits that can hold the range.

If you're using Ada-95, it seems to me that giving each side compatible
compatible definitions of 'Write and 'Read along with the type declaration
is easier than forcing each client to do a conversion.

---------------------------------------------------------------------------
W. Wesley Groleau (Wes)                                Office: 219-429-4923
Hughes Defense Communications (MS 10-41)                 Home: 219-471-7206
Fort Wayne,  IN   46808                  (Unix): wwgrol@pseserv3.fw.hac.com
---------------------------------------------------------------------------




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

* Re: fixed point type over an interface.
  1997-02-12  0:00 fixed point type over an interface W. Wesley Groleau (Wes)
@ 1997-02-12  0:00 ` Robert Dewar
  1997-02-12  0:00 ` Robert Dewar
  1 sibling, 0 replies; 3+ messages in thread
From: Robert Dewar @ 1997-02-12  0:00 UTC (permalink / raw)



Wes said

<<If you are using Ada-83, I know of at least one compiler where a rep-spec
on 'Small cannot be trusted.  This compiler always uses a multiple of
four bits for the fractional part, and for the integer part, uses the
smallest multiple of four bits that can hold the range.
>>

There can always be bugs in compilers, and this is clearly one! If it is
still there in the current release, it should be fixed.

But I don't see any point in suggesting that ones choice of techniques
should be influenced by one particular bug in one particular compiler
that you happen to know about!





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

* Re: fixed point type over an interface.
  1997-02-12  0:00 fixed point type over an interface W. Wesley Groleau (Wes)
  1997-02-12  0:00 ` Robert Dewar
@ 1997-02-12  0:00 ` Robert Dewar
  1 sibling, 0 replies; 3+ messages in thread
From: Robert Dewar @ 1997-02-12  0:00 UTC (permalink / raw)



Wes said

<<If you're using Ada-95, it seems to me that giving each side compatible
compatible definitions of 'Write and 'Read along with the type declaration
is easier than forcing each client to do a conversion.>>

And, as I mentioned before, one nice way to do this is to use the XDR
implementation of the default stream attributes that is provided as 
part of the GLADE package. This will be completely portable between
GNAT compiled programs on diverse systems, though of course it will
not solve the problem of talking to other compilers, unless they provide
similar functionality.





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

end of thread, other threads:[~1997-02-12  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-02-12  0:00 fixed point type over an interface W. Wesley Groleau (Wes)
1997-02-12  0:00 ` Robert Dewar
1997-02-12  0:00 ` Robert Dewar

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