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 12:53:07 PST Path: archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!zeus.visi.com!news-out.visi.com!green.octanews.net!news-out.octanews.net!news.glorb.com!wn51feed!worldnet.att.net!attbi_s02.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: data types & efficiency References: X-Newsreader: Tom's custom newsreader Message-ID: NNTP-Posting-Host: 24.6.132.82 X-Complaints-To: abuse@comcast.net X-Trace: attbi_s02 1078519987 24.6.132.82 (Fri, 05 Mar 2004 20:53:07 GMT) NNTP-Posting-Date: Fri, 05 Mar 2004 20:53:07 GMT Organization: Comcast Online Date: Fri, 05 Mar 2004 20:53:07 GMT Xref: archiver1.google.com comp.lang.ada:6098 Date: 2004-03-05T20:53:07+00:00 List-Id: > 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. Usually people want their program to *run* the same regardless of which compiler compiled it. You seem to want its data area to be the same size, the maximum size any compiler might use. Why is that? Thus a program to play cards might define type Suite is (Clubs, Diamonds, Hearts, Spades); A memory optimizing compiler on a suitably addressable architecture might use 2 bits. Another compiler on another machine might use 32. Why do you require that they both use 32 bits to represent the four possible values? For Integer, don't use the predefined type and assume it's, say, 32 bits. Instead declare your own type home_thermostat_F_settings is range 55.. 90; type person_numbers is range 0 .. 50_000_000_000; and let different compilers on different architectures use different storage arrangements - your data values will never fall outside those ranges so any extra bits are immaterial to the correct running of your program.