From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.4 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00 autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ac2397ce800de518 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-09-06 08:04:00 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!195.64.68.27!newsgate.cistron.nl!psiuk-p2!uknet!psiuk-n!news.pace.co.uk!nh.pace.co.uk!not-for-mail From: "Marin David Condic" Newsgroups: comp.lang.ada Subject: Re: adasockets and adatypes Date: Thu, 6 Sep 2001 10:16:34 -0400 Organization: Posted on a server owned by Pace Micro Technology plc Message-ID: <9n80g4$o9r$1@nh.pace.co.uk> References: <20010904115244.24236db3.tonygair@blueyonder.co.uk> <9n2lpb$c7b$1@nh.pace.co.uk> NNTP-Posting-Host: dhcp-200-133.miami.pace.co.uk X-Trace: nh.pace.co.uk 999785796 24891 136.170.200.133 (6 Sep 2001 14:16:36 GMT) X-Complaints-To: newsmaster@news.cam.pace.co.uk NNTP-Posting-Date: 6 Sep 2001 14:16:36 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Xref: archiver1.google.com comp.lang.ada:12800 Date: 2001-09-06T14:16:36+00:00 List-Id: Not exactly sure I understand what you are describing, but I will say this: I've used C to read/write data to a stream and usually, I've resorted to having some function that manually tore the data apart and put it into the stream - not dissimilar to creating a 'Read or 'Write procedure for some structure. I've had to do that because C didn't provide a good way for me to control where the bits and bytes fell within a struct and the minute something got the least bit unusual, you just couldn't get there with its lame representation specifications. In simpler cases where I got to define the message content, you could basically build a struct that was at least consistent and do some kind of overlay or similar pointer tricks to just get it as a stream of bytes. As for endianness and/or some kind of general portability, I've not had to deal with that in C because the environment was usually self-contained enough that you could be sure that both ends were doing the same thing. Those who insist on absolute portability don't have the balls to live in the real world. :-) MDC -- Marin David Condic Senior Software Engineer Pace Micro Technology Americas www.pacemicro.com Enabling the digital revolution e-Mail: marin.condic@pacemicro.com Web: http://www.mcondic.com/ "Simon Wright" wrote in message news:x7vpu96ehbx.fsf@smaug.pushface.org... > > I would have thought the ideal non-automated C way of doing this would > be to define a wire format that is convenient for manipulating > endianness (eg, no packing) and manually stuff this on the way > out/unstuff on the way in. Far less dangerous than trying to > manipulate packed data. > > Sometimes the transport mechanism forces you to use the same length > for every component -- eg, X properties, where you can choose 1/2/4 > byte length and the server byteswaps for you.