comp.lang.ada
 help / color / mirror / Atom feed
From: Florian Weimer <fw@deneb.enyo.de>
Subject: Separate type for byte arrays
Date: Thu, 04 May 2006 15:35:39 +0200
Date: 2006-05-04T15:35:39+02:00	[thread overview]
Message-ID: <87irolhpzo.fsf@mid.deneb.enyo.de> (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.



             reply	other threads:[~2006-05-04 13:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-04 13:35 Florian Weimer [this message]
2006-05-04 14:21 ` Separate type for byte arrays 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
replies disabled

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