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,d7ae8269a4ecf7c4 X-Google-Attributes: gid103376,public From: Ken Garlington Subject: Re: Prevalence of Compilers for Which Integer'Size < 32? Date: 1996/08/07 Message-ID: <32089CC9.2C19@lmtas.lmco.com>#1/1 X-Deja-AN: 172787175 references: <4tdp24$5h1@news.pacifier.com> <31FE0C01.302F@lmtas.lmco.com> <31FF5CF0.5C13@lmtas.lmco.com> content-type: text/plain; charset=us-ascii organization: Lockheed Martin Tactical Aircraft Systems mime-version: 1.0 newsgroups: comp.lang.ada x-mailer: Mozilla 2.02 (Macintosh; I; 68K) Date: 1996-08-07T00:00:00+00:00 List-Id: Robert Dewar wrote: > > You missed my point, case (b) is *exactly* the case where the name > Word_Length_In_Bits might be appropriate if that is what you really > want. Of course if you use the software somewhere where the machine > word is not 32-bits, then you would have to modify this declaration. Perhaps I misunderstood. I thought the intent was to declare an integer value that would always fit in 32 bits, regardless of machine word size. If that's the case, wouldn't Word_Length_In_Bits always be 32, for all machines, for the code I gave earlier? And, if that's the case, wouldn't a maintainer seeing this on a 16-bit machine say, "Wait a minute, word length isn't 32 on my machine, better change this to 16..." - and end up with anInt32 being a 16-bit value? > Ada code can be made to be automatically portable most of the time, but > not necessarily all the time, since the predefined set of attributes is > not necessarily powerful enough to parametrize everything you want. > In this particular case, if you really wanted the machine word size > to govern the length of the type, you could probably use > System.Word_Size (or in GNAT Standard'Word_Size) and completely avoid > the dreaded 32, in the declaration as *well* as in the name. I think this is true if anInt32 was supposed to be anIntWord. If that was the intent, I misunderstood. I thought the original thread was: How do I make an integer that will always be 32 bits, even on a 16 bit machine? and the answer was: Optimal_Name : constant := 32; type anInt32 is range -(2**(Optimal_Name-1)) .. 2**(Optimal_Name-1)-1; or something to that effect? -- LMTAS - "Our Brand Means Quality"