comp.lang.ada
 help / color / mirror / Atom feed
* Separate type for byte arrays
@ 2006-05-04 13:35 Florian Weimer
  2006-05-04 14:21 ` Frank J. Lhota
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Florian Weimer @ 2006-05-04 13:35 UTC (permalink / raw)


Does it make sense to provide low-level I/O interfaces in terms of
octet arrays as well as in terms of strings?  In other words,

  procedure Read
     (Ch : in out Input_Channel;
      Item : out Byte_Array;
      Length: out Byte_Count);

in addition to 

  procedure Read
     (Ch : in out Input_Channel;
      Item : out String;
      Length: out Natural);

?  This is a bit cumbersome.  Unfortunately, it's not possible to make
Read itself generic because it's a dispatching subprogram.  If you
parameterize the whole I/O subsystem on the element and array type,
you still have the problem that no efficient communication is possible
between two subsystems which store data in different array types
(without using Unchecked_Conversion).  The other alternative is to
create some kind of buffer object which can be accessed as octet and
character array.  I've implemented this, and it doesn't look quite
right, either.

Any suggestions?  I'm aiming for something similar java.nio.*.

I'm not interested in machines which use strange character sets such
as EBCDIC, or machines whose storage unit or stream element size is
not 8 bit.



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

end of thread, other threads:[~2006-05-04 18:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-04 13:35 Separate type for byte arrays Florian Weimer
2006-05-04 14:21 ` Frank J. Lhota
2006-05-04 15:14   ` Florian Weimer
2006-05-04 16:17 ` Dmitry A. Kazakov
2006-05-04 18:15 ` Jeffrey R. Carter

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