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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,971aa11c293c3db1 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-07-20 06:24:03 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!193.251.151.101!opentransit.net!proxad.net!nerim.net!norfair.nerim.net!not-for-mail From: "Bertrand Augereau" Newsgroups: comp.lang.ada Subject: Re: Ada The Best Language? Date: Fri, 20 Jul 2001 15:28:25 +0200 Organization: Nerim -- xDSL Internet Provider Message-ID: <9j9bdh$22kn$1@norfair.nerim.net> References: <5be89e2f.0107170838.c71ad61@posting.google.com> <5be89e2f.0107180235.726d46a8@posting.google.com> <3B55B01A.DAC06D79@icn.siemens.de> <5be89e2f.0107181248.73298c57@posting.google.com> <9j949b$1ujp$1@norfair.nerim.net> <9j983r$20jq$1@norfair.nerim.net> NNTP-Posting-Host: aboukir-101-2-1-inutero.adsl.nerim.net X-Trace: norfair.nerim.net 995635441 68247 62.4.19.69 (20 Jul 2001 13:24:01 GMT) X-Complaints-To: abuse@nerim.net NNTP-Posting-Date: Fri, 20 Jul 2001 13:24:01 +0000 (UTC) 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:10331 Date: 2001-07-20T15:28:25+02:00 List-Id: > > Please specify the C++ Code for offset 6. > [...] > dont_fragment at 6 range 6 .. 6; > more_fragments at 6 range 5 .. 5; > offset1 at 6 range 0 .. 4; > [...] > If I don't get something wrong (I'm at work so I don't have much time... or do I ;-) ): I'm not that sure of the exact semantics of 'at position range a..b' struct Head { ... unsigned int offset1:5; unsigned int more_fragments :1; unsigned int dont_fragment : 1; unsigned int pad:1; .. } But you have to ensure the previous elements of the structure make the padding right. that's what I said there "(well almost exactly, you have to take care of the offset with appropriate padding, but bitfields take care of the 'range')" Ok this is a lame disclaimer ;-) > Ada95 still have problems, there is no portable way to specify the layout of > the whole 12bit offset. > > >But I'm not sure of endianness consideration in both cases, especially for > >network code. > > https://www.iks-jena.de/mitarb/lutz/ada/net/net-portability__adb.htm > > It's horrible ugly, but compile time evaluable and the generated code is > incredibly fine. Ever seen a Compiler generating an endian prefix on alpha? Sometimes you have to live with ugliness...