comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Simple Data Endianness
Date: Thu, 13 Feb 2020 16:57:43 +0100
Date: 2020-02-13T16:57:43+01:00	[thread overview]
Message-ID: <r23rlm$pli$1@gioia.aioe.org> (raw)
In-Reply-To: 21f3f3e5-b462-4359-adf9-700c5647f573@googlegroups.com

On 2020-02-13 16:44, Daniel wrote:
> i guess you want to serialize this data between 2 diferents CPUs families.
> 
> I think ADA only thought an automatic solution for mapped records.
> 
> You have two solutions.
> 
> First is really ugly: Put that type into a field of a single field mapped record.
> 
> Sencod is also ugly: Swap by your self the 4 bytes of this 32 bits type. Gnat have for example gnat.Byte_Swapping.Swap4 library to do it.

Just use a reasonable network data distribution protocol or some custom 
serialization/deserialization method.

A protocol that uses 4 octets to transfer 4 enumeration states is not 
reasonable by any count.

In any case, never use protocol representations to store application 
data. This is an exemplary case of abstraction inversion.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


  reply	other threads:[~2020-02-13 15:57 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-13  9:42 Simple Data Endianness guijarrockguijarro
2020-02-13 11:10 ` Dmitry A. Kazakov
2020-02-13 15:12   ` Optikos
2020-02-13 15:28     ` Dmitry A. Kazakov
2020-02-13 16:47       ` Optikos
2020-02-13 17:29         ` Dmitry A. Kazakov
2020-02-13 20:36           ` Optikos
2020-02-14  8:20             ` Dmitry A. Kazakov
2020-02-14 17:25               ` Optikos
2020-02-14 20:22                 ` Dmitry A. Kazakov
2020-02-15 14:56                   ` Optikos
2020-02-13 15:44 ` Daniel
2020-02-13 15:57   ` Dmitry A. Kazakov [this message]
2020-02-14 16:52 ` Shark8
replies disabled

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