comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@acm.org
Subject: Re: Hints for networking
Date: Fri, 31 Jan 2003 18:40:48 GMT
Date: 2003-01-31T18:40:48+00:00	[thread overview]
Message-ID: <Qqz_9.108166$Ve4.7449@sccrnsc03> (raw)
In-Reply-To: MPG.18a4c4d14186a6f598968c@News.CIS.DFN.DE

> Also, I've my doubts about streams, because in the past I've tried them
> to write files and in Gnat I couldn't manage to output exact sized types
> except uncheckedconverting
  Streams can be quite convenient, but they are like programming without
rep clauses.  If the representation doesn't matter, fine.  If it does,
you have to write your own 'read/'write routines to and from
Stream_Element_Array.  But you probably want your IO to be in terms of
objects at a higher level than Integer or Boolean, etc, so you would
want to write your own Some_Record 'Write routines anyway.
At the low level, your code will contain things like
  type Some_Record is record
  ...
  subtype External_Form_Some_Record is Ada.Streams.Stream_Element_Array(1 .. 6);
  function External_Some_Record is new Ada.Unchecked_Conversion
    (Source=>Some_Record, Target=>External_Form_Some_Record);
but at higher levels writing a complex object just becomes a series of
calls to 'Write on lower level subrecords, and, if there's nothing fancy
going on, you can let the compiler create the series of subrecord 'Writes.



  reply	other threads:[~2003-01-31 18:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-31 16:37 Hints for networking Jano
2003-01-31 18:40 ` tmoran [this message]
2003-01-31 21:21 ` David C. Hoos
2003-02-01 19:29   ` Jano
2003-02-02  7:43     ` Simon Wright
2003-02-01 18:32 ` Alfred Hilscher
replies disabled

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