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-Thread: 103376,4ff929aa5c2b2834 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns13feed!worldnet.att.net!attbi_s71.POSTED!53ab2750!not-for-mail From: "Jeffrey R. Carter" Organization: jrcarter at acm dot org User-Agent: Thunderbird 1.5.0.8 (Windows/20061025) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Ranges and (non)static constraints References: <1163679831.668031.123360@h54g2000cwb.googlegroups.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 12.201.97.213 X-Complaints-To: abuse@mchsi.com X-Trace: attbi_s71 1163703699 12.201.97.213 (Thu, 16 Nov 2006 19:01:39 GMT) NNTP-Posting-Date: Thu, 16 Nov 2006 19:01:39 GMT Date: Thu, 16 Nov 2006 19:01:39 GMT Xref: g2news2.google.com comp.lang.ada:7510 Date: 2006-11-16T19:01:39+00:00 List-Id: Maciej Sobczak wrote: > > OK, now I see - but is there any preference I should give to one of > these two forms apart from that? I understand that the second form is > the only I can use if the range is not statically known and (what > surprised me) when the constraints come from formal generic parameters. > But even if the range is known statically, I might choose to always use > the second form for notational consistency. Is this recommended? No. You're relying on Integer, which is only required to be 16 bits. In addition, Integer is the only required predefined integer type. So using Long_Integer and its friends is not portable. So it's best to use the 1st form whenever possible. When you must have a non-static range, you should define your own parent type using application limits on the possible range to derive from. If there are no such limits, then use a type based on System.Min_Int and System.Max_Int to derive from. > Assuming that T'Size = U'Size, can I expect any run-time observable > (including performance) differences between T and U? There should be none. In your example, U'Size = Integer'Size. -- Jeff Carter "Hello! Smelly English K...niggets." Monty Python & the Holy Grail 08