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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d23a9c52d1958b6a X-Google-Attributes: gid103376,public From: dewar@cs.nyu.edu (Robert Dewar) Subject: Re: Problem to dramatize packed-array/rep-clause difficulties Date: 1996/03/28 Message-ID: #1/1 X-Deja-AN: 144704952 references: <4jdcf6$7gc@news2.delphi.com> organization: Courant Institute of Mathematical Sciences newsgroups: comp.lang.ada Date: 1996-03-28T00:00:00+00:00 List-Id: tmoran says " Of course an array of n bit fields will always have the packing pattern repeat after Least Common Multiple(n,8) bits, and thus can be viewed as an array of LCM(n,8)/8 -byte records, each containing LCM(n,8)/n fields. If access to the J-th of a packed array of n-bit items is most efficiently implemented on a particular machine by using a case statement on the J/(LCM(n,8)/n)-th group, then by definition a 'smart' compiler for that machine does it that way." I disagree. It is *extremely* unlikely that any Ada compiler that *did* implement jamming of 9-bit packed arrays would to it this way. Certainly the only Ada compilers that I have seen that do support such packed arrays do not take this approach. Supporting 9-bit packed arrays is hard work anyway, doing it in the manner that tmoran suggests would add a LOT of work to a compiler implementation for a an extremely marginal feature. And that is really the point. You want to limit the requirements for implementation of rep clause level features to those cases which the compiler can do efficiently without remarkable optimization effort. Most programers do not like to rely on "big" optimizations of this type. If you want to use the LCM method, then you can perfectly easily program it yourself, and it will be comparably efficient to what the compiler could do. It's a bit like the RISC situation. In choosing the primitives of the language, we choose those things which you cannot easily and efficiently add on as packages, but you don't build in things which can easily be added as packages, because it's very hard to decide what this set shoud be, and more to the point, why make the compiler more complex for no real gain.