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,74bfb16f8a37fb10 X-Google-Attributes: gid103376,public From: mheaney@ni.net (Matthew Heaney) Subject: Re: operands of membership tests Date: 1997/10/26 Message-ID: #1/1 X-Deja-AN: 285244579 References: Organization: Estormza Software Newsgroups: comp.lang.ada Date: 1997-10-26T00:00:00+00:00 List-Id: In article , dewar@merv.cs.nyu.edu (Robert Dewar) wrote: ><> > >Then this is obviously statically illegal, end of discussion Perhaps I mistated my question; please forgive me. The code below compiles cleanly (using GNAT 3.10), and produces the following output: 33_000 > T'Base'Last: TRUE 33_000 in T: FALSE 33_000 in T'Base: FALSE Since this code is "statically legal," then it begs another question: What is the definition of "base range"? I assumed that if 33_000 were greater than T'Base'Last, then that meant it wasn't in the base range. Is this assumption incorrect? Sometimes a (static) literal, outside the base range of the type, is flagged as illegal at compile-time. Yet in this example, we have a literal outside the base range of the type, that isn't flagged. My question is this. What are the circumstances under which a static literal expression is illegal, because it's outside the base range of the type? -- STX with Ada.Text_IO; use Ada.Text_IO; procedure Test_Mem is type Fixed is delta 1.0 range 0.0 .. 256.0; for Fixed'Small use 1.0; begin Put ("33_000 > T'Base'Last: "); Put (Boolean'Image (33_000.0 > Fixed'Base'Last)); New_Line; Put ("33_000 in T: "); Put (Boolean'Image (33_000.0 in Fixed)); New_Line; Put ("33_000 in T'Base: "); Put (Boolean'Image (33_000.0 in Fixed'Base)); New_Line; end; -- ETX -------------------------------------------------------------------- Matthew Heaney Software Development Consultant (818) 985-1271