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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!usenet-fr.net!feeder1-2.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Tue, 23 Jul 2013 23:46:52 +0200 From: Georg Bauhaus User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: What about a Static_Assertion? References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Message-ID: <51eef9cd$0$6557$9b4e6d93@newsspool4.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 23 Jul 2013 23:46:53 CEST NNTP-Posting-Host: 2485bca4.newsspool4.arcor-online.net X-Trace: DXC=SQ=PSET6E?FAa;:RKVJ>LE4IUKejVH^6eOPAkZFb@lW>XM_`:n^N X-Complaints-To: usenet-abuse@arcor.de Xref: news.eternal-september.org comp.lang.ada:16505 Date: 2013-07-23T23:46:53+02:00 List-Id: On 23.07.13 20:07, Yannick DuchĂȘne (Hibou57) wrote: > > I believe this would not be too much a nightmare to be added to any Ada 202X, this would just requires a check on the kind of the expression used for the assertion, and failure of a static assertion, could be said to make the compilation to necessary fails. It should take no more than a little syntax, I think, and no other changes to compilers are needed, insofar as compilers have calculated static Boolean expressions for a long time. The following two static tests builds on discrete_choice_lists covering all values in type Boolean: package Static_Assertion is Test: constant Boolean := ((not True) or False); -- see below private type Check1 (Dummy : Boolean) is record case Dummy is when Test => null; when False => null; end case; end record; type Nix is access constant Boolean; for Nix'Storage_Size use 0; Check2 : constant array (Boolean) of Nix := (Test => null, False => null); end Static_Assertion; Check2 declares an object, while Check1 does not.