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,df854b5838c3e14 X-Google-Attributes: gid103376,public From: bobduff@world.std.com (Robert A Duff) Subject: Re: Gripe about Ada, rep specs that won't. Date: 1996/03/23 Message-ID: #1/1 X-Deja-AN: 143880265 references: <00001a73+00002504@msn.com> <4iv0g6$6cs@news4.digex.net> organization: The World Public Access UNIX, Brookline, MA newsgroups: comp.lang.ada Date: 1996-03-23T00:00:00+00:00 List-Id: In article , Robert Dewar wrote: >This seems truly bizarre. Doug is complaining about not being able to >pack 9-bit arrays, a feature that > >(a) is certainly absence from C and C++ which don't support packed > arrays at all > >(b) most people think is not of sufficient use in Ada to be mandated > though some compilers do support it (e.g. the old Alsys > technology). I agree. However, I have *some* sympathy for the other side of this argument. Ada *claims* to support representation clauses, which map nice high-level data stuctures onto low-level hardware. But it doesn't always work. It doesn't work when you have a single logical field split across two separate physical fields (as in the segment tables on a 386, where the segment size is split in two -- not to mention that it's sometimes counting bytes, and sometimes counting pages, based on another bit somewhere else in the record). It doesn't work if the "discriminant" in the hardware is some weird function of various bit fields, when Ada wants a simple integer field. It doesn't work for a stream of variable-length records -- you can't model the instruction stream on a CISC machine as an array of rep-claused records. If you happen to run into these nasty cases often (which depends on what hardware you're trying to interface to), then it seems rather annoying that your compiler vendor spends a lot of time implementing a feature that doesn't suit your needs. Furthermore, you feel cheated if you use a packed array of 4-bit components, and it works find, but then you want to do the same thing with 9-bit components, and the compiler doesn't support tight packing. You have to use a totally different interface in the 9-bit case. If you used C from the start, you wouldn't get annoyed, because you would do all the packing by hand anyway, so you wouldn't have to change your strategy when going from 4-bit components to 9-bit components. Having said all that, I think that tight packing of 9-bit components is something the market, and not the Ada RM, should decide. If people want it, it will become a defacto standard. If not, do it by hand, and you're no worse off then if you used any other language. - Bob