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: Doug Rogers Subject: Gripe about Ada, rep specs that won't. Date: 1996/03/21 Message-ID: <4iq71v$cvr@news4.digex.net>#1/1 X-Deja-AN: 143448897 references: <00001a73+00002504@msn.com> <3146E324.5C1E@lfwc.lockheed.com> <4i98gg$8n1@solutions.solon.com> <4ia41k$e04@solutions.solon.com> <4ik5ip$cl6@watnews1.watson.ibm.com> content-type: text/plain; charset=us-ascii organization: Innovative Concepts, Inc. x-url: news:4ik5ip$cl6@watnews1.watson.ibm.com mime-version: 1.0 newsgroups: comp.lang.ada x-mailer: Mozilla 1.1N (X11; I; Linux 1.2.4 i486) Date: 1996-03-21T00:00:00+00:00 List-Id: For what it's worth, here's my biggest (note that there are plenty of others) gripe about Ada: compiler vendors are not forced to adhere to rep specs for bit-level access. This is infuriating for anyone doing embedded code. For example, I've got an array of nine-bit numbers. I can easily set up a type Natural9 is 0 .. (2 ** 9) - 1; and I can even say for Natural9'size use 9. But when I say type Bunch_O_9s is array (Integer 1 .. 4) of Natural9, I can't pragma Pack (Bunch_O_9s). Or, I can, but each compiler can tell me "No way, man!", either immediately or when I try to set for Bunch_O_9s'size use 36. The problem is even worse for records (and variant records, which are another gripe of mine -- no true "union" -- don't get me started!). The only solution is to set up an array of bits and extract each element yourself, which is a royal pain in the ass. Sure, you can generisize it, using Unchecked_Conversion, or some equally hideous thing along the way. Hardly elegant. For my two bits worth, Ada0x should force compilers to honor rep specs to the bit, even if they "violate" machine alignment. Warnings are great for that kind of thing (if you care). Why make every new project develop its own bit manipulation packages? Let the compiler do it. If you need the efficiency, then write your own. C/C++ suffers from the same problem, but at least there's no misunderstanding in C/C++. You're expected to do that kind of thing, and the promotion/demotion provides a much easier and more portable solution. To anyone who has an elegant solution to this problem: I'd love to hear from you. Doug =------cxiuj-opinioj-estas-sole-miaj.-----any-opinions-are-mine-alone.------= = Doug Rogers vocxe/voice = 1.703.893.2007 fakse/fax = 1.703.893.5890 = = Innovative Concepts Inc; 8200 Greensboro Drive Suite 801; McLean VA 22102 = = PGP ID: pub 1024/016DE91D 1994/11/14 Doug Rogers = =senemankasalvimultodatempolernulaanglan-ifyouvegotalittletimelearnesperanto=