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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: AI12-0218: What is the portable representation clause for processing IETF packets on little-endian machines? Date: Wed, 30 May 2018 07:39:07 +0100 Organization: A noiseless patient Spider Message-ID: References: <5f1e44fa-5b78-45a1-a12e-b8089d823540@googlegroups.com> <9ae54be5-0b96-4675-ad95-7a61ecc6fbd0@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: h2725194.stratoserver.net; posting-host="ce67fdd04031a3ccb5975a669dc34b00"; logging-data="1674"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/+M3GeH3fQWfiuGkhTi5QrtnZIhSnH29E=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (darwin) Cancel-Lock: sha1:yhjXkSfXeqrKmwu5VZoddPNX7Oc= sha1:hl8+q1tQQTPwc/U22oN7BFxyMxU= Xref: reader02.eternal-september.org comp.lang.ada:52776 Date: 2018-05-30T07:39:07+01:00 List-Id: "Randy Brukardt" writes: > "Simon Wright" wrote in message > news:ly4litj7qx.fsf@pushface.org... >> But it doesn't do byte swapping. > > Thank goodness. People use rep. clauses all the time in code that > permeates an entire program; having very expensive byte swapping code > easily triggered would give Ada a reputation of being a slug (rather > than understanding that the code misuses the features). The whole idea > of portable representation clauses is close to misuse of the feature > (the entire value is to ensure that compilers for the same target > intepret the clauses the same way). (a) In that case, the LRM should point out this potential problem in red block caps; or eliminate rep clauses altogether and make us use C-style shifts and masks (I think that's what Dmitry does anyway). (b) My experience of rep clauses is communication with other machines, be they NTP time servers over a network or hardware interface cards. I don't understand "ensure that compilers for the same target intepret the clauses the same way".