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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8b5b40006550b942 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-03-05 11:05:44 PST Path: archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!priapus.visi.com!orange.octanews.net!news.octanews.net!green.octanews.net!news-out.octanews.net!news.glorb.com!newsgate.cistron.nl!amsnews01.chello.com!news.cambrium.nl!news.cambrium.nl!humbolt.nl.linux.org!news.nl.linux.org!surfnet.nl!teleglobe.net!151.99.250.105.MISMATCH!news.finmeccanica.it!not-for-mail From: "Davide" Newsgroups: comp.lang.ada Subject: Re: data types & efficiency Date: Fri, 5 Mar 2004 16:54:03 +0100 Organization: Finmeccanica Message-ID: References: <5ohg40ls073v1b5d8idail4t365f57l8os@jellix.jlfencey.com> NNTP-Posting-Host: 192.168.54.114 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Xref: archiver1.google.com comp.lang.ada:6094 Date: 2004-03-05T16:54:03+01:00 List-Id: >"Vinzent 'Gadget' Hoefler" wrote: >Why? If you're interfacing to some external (hardware) interface you >have to specify a certain size independent from the >target-architecture, but if you don't need this I don't see why you >should *have* to specify some size at all. Well, requirements are to "redefine" the predefined types as Boolean, Integerer, etc... to enforce the indepence from compiler in terms of their internal representation. So I will define for example: type UNSIGNED_INT_32_TYPE is range 0..(2**32)-1: for UNSIGNED_INT_32_TYPE'SIZE use 32; to be used instead of the predefined Integer type. One thing that I don't know is if I define: subtype SMALLER_INT_TYPE is UNSIGNED_INT_32_TYPE range 0..150; then, generally, the compiler can still optimize the representation in spite of the clause: for UNSIGNED_INT_32_TYPE'SIZE use 32; ? What do you know about this? Thanks. P.S.: My compiler's (Adamulti) manual is not clear about this. I made an experiment with GNAT and it seems that it represents SMALLER_INT_TYPE as a byte. So this compiler still optimizes the subtype. In this case your answer: >3) Declare the type by specifying its range and let the compiler >figure out what could be more efficient on the hardware. would make sense also for my particular case. I hope I've been clear...sorry for my bad english...and also please consider I'm just beginning with Ada development.