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,9e499c74312ed3f0 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-05-17 16:03:55 PST Newsgroups: comp.lang.ada Path: archiver1.sj.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.mathworks.com!news.mathworks.com!uunet!ash.uu.net!xyzzy!nntp From: Jeffrey Carter Subject: Re: Static assertions X-Nntp-Posting-Host: e246420.msc.az.boeing.com Content-Type: text/plain; charset=us-ascii Message-ID: <3B0451F7.6D5B7024@boeing.com> Sender: nntp@news.boeing.com (Boeing NNTP News Access) Content-Transfer-Encoding: 7bit Organization: The Boeing Company X-Accept-Language: en References: <9e0pfb$ao9$1@s1.read.news.oleane.net> <3B040DE4.468E779F@boeing.com> <9e17la$km6$1@nh.pace.co.uk> Mime-Version: 1.0 Date: Thu, 17 May 2001 22:34:31 GMT X-Mailer: Mozilla 4.5 [en]C-CCK-MCD Boeing Kit (WinNT; U) Xref: archiver1.sj.google.com comp.lang.ada:7625 Date: 2001-05-17T22:34:31+00:00 List-Id: Marin David Condic wrote: > > You have to be careful of the declarations. Just because you maybe did > something to declare (for example) a 16 bit integer type, doesn't mean that > 'Size for the type won't end up as 32. Even if you use a rep clause, the > compiler doesn't have to honor it - although one would hope it was at least > polite enough to inform you of that fact. > > Perhaps you could post the code you created to test it? The code was identical to that posted by JPR, except that 32 was changed to 16, and 4 was changed to 8. This makes both expressions False (for me, but I would hope at least one of them would be False on every system). The test program simply used Integer'Image and Put_Line to output the values of the 2 constants. > > MDC > -- > Marin David Condic > Senior Software Engineer > Pace Micro Technology Americas www.pacemicro.com > Enabling the digital revolution > e-Mail: marin.condic@pacemicro.com > Web: http://www.mcondic.com/ > > "Jeffrey Carter" wrote in message > news:3B040DE4.468E779F@boeing.com... > > Jean-Pierre Rosen wrote: > > > > > > package Verifier is > > > subtype Assert is Boolean range True..True; > > > > > > Assert_1 : constant := Boolean'Pos( Assert (Integer'Size=32) ); > > > Assert_2 : constant := Boolean'Pos( Assert > > > (Integer'Size=4*Character'Size) ); > > > end Verifier; > > > > > > (The Boolean'Pos serves to have a value used in a named number > declaration, > > > which requires a static context). > > > > Interesting. However, Rational Apex 2.4.6 on HP compiles this fine even > > if the declarations are changed to make the expressions false. A test > > program to output the values of Assert_X produces 2 zeros. > > > > If I change the declarations to > > > > Assert_1 : constant Assert := Integer'Size = 73; > > > > then the unit will not compile. > > > > -- > > Jeffrey Carter -- Jeffrey Carter