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=0.7 required=5.0 tests=BAYES_00,INVALID_DATE, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,92882847c09de3aa X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1995-01-04 07:56:22 PST Path: nntp.gmd.de!newsserver.jvnc.net!howland.reston.ans.net!swiss.ans.net!newsgate.watson.ibm.com!watnews.watson.ibm.com!ncohen From: ncohen@watson.ibm.com (Norman H. Cohen) Newsgroups: comp.lang.ada Subject: Re: Language Lawyers help on rep_specs Date: 4 Jan 1995 14:40:50 GMT Organization: IBM T.J. Watson Research Center Distribution: world Message-ID: <3eec1i$179s@watnews1.watson.ibm.com> References: <393@hathor.CSS.GOV> Reply-To: ncohen@watson.ibm.com NNTP-Posting-Host: rios8.watson.ibm.com Keywords: Rep_Spec LRM Date: 1995-01-04T14:40:50+00:00 List-Id: In article <393@hathor.CSS.GOV>, jeffe@hathor.CSS.GOV (Jeff Etrick) writes: |> The LRM references are saying that my type Nuclear_Date_Times may not be |> used in a record represenation clause due to the fact it is not a simple |> static expression. Talking to the vendor about this issue I was told that the |> INTEGER conversion is a function and functions are not allowed in simple |> static expressions. ... |> subtype Full_Integer is INTEGER range -2**31..2**31 - 1; |> |> HOURS_IN_DAY : constant := 24; |> MINUTES_IN_HOUR : constant := 60; |> MINUTES_IN_DAY : constant := HOURS_IN_DAY * MINUTES_IN_HOUR; |> |> -- This type defines days from December 30, 1944 through December 31, 2099. |> type Dates is new Full_Integer range -1 .. 56_613; ... |> type Nuclear_Date_Times is new Full_Integer |> range (INTEGER (Dates'first) - 1) * MINUTES_IN_DAY |> .. (INTEGER (Dates'last) * MINUTES_IN_DAY) - 1; Type conversions may look like function calls, but they are not. In any event, RM95 4.9(9) specifically states that conversion of a static expression (such as Dates'First or Dates'Last) to a static subtype (such as Integer) is static. You could have achieved the same effect more simply, however, by writing type Nuclear_Date_Times is range (Dates'First-1)*Minutes_In_Day .. Dates'Last*Minutes_In_Day-1; (While the bounds in the range constraint of a derived-type declaration must belong to the parent type, the bounds in an integer type declaration can belong to any integer type, making the type conversion unnecessary.) -- Norman H. Cohen ncohen@watson.ibm.com