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-Thread: a07f3367d7,7e490a18b9688bd9 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!feeder.erje.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Stream_Element_Array Date: Wed, 14 Sep 2011 11:53:13 +0100 Organization: A noiseless patient Spider Message-ID: References: <1e6rw4vto3ldb.i8d7fxixapx4.dlg@40tude.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx04.eternal-september.org; posting-host="dFCm8HWntFqmDIilBLqEJQ"; logging-data="13958"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/ijVNNfgxm9lOW45XEY/kpTMQmxw4yydw=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (darwin) Cancel-Lock: sha1:5OBjpCYNk5LV60EIKxb2K2qzlA8= sha1:MnWSD/mkwzgnhKFVeRccavTuQHU= Xref: g2news1.google.com comp.lang.ada:20932 Date: 2011-09-14T11:53:13+01:00 List-Id: "Dmitry A. Kazakov" writes: > P.S. Do not use representation clauses or unchecked conversion, I *do* > mean it: I would of course agree if the data type didn't occupy the full width of the buffer it was being converted into. I suppose that can happen quite frequently? (I took OP's "Unsigned_16" to mean a 16-bit wide type). Shouldn't be a similar problem with endianness conversions, though. > P.P.S. Stream element might be not the best choice if you are > communicating with the external world. You could also consider taking > Unsigned_8 and an array built upon it, because in most cases the > hardware talks in octets. That does not change the pattern, of > course. I know the RM doesn't specify this, and goes out of its way to allow 9-bit bytes and 36-bit storage units. But how many real-life situations are there where Stream_Element'Size isn't 8? Of course, if your hardware registers are 16 or 32 bits wide, that's a different ballgame.