From: Georg Bauhaus <rm.dash-bauhaus@futureapps.de>
Subject: Re: What about a Static_Assertion?
Date: Tue, 23 Jul 2013 23:46:52 +0200
Date: 2013-07-23T23:46:53+02:00 [thread overview]
Message-ID: <51eef9cd$0$6557$9b4e6d93@newsspool4.arcor-online.net> (raw)
In-Reply-To: <op.w0osngz1ule2fv@cardamome>
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.
prev parent reply other threads:[~2013-07-23 21:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-23 18:07 What about a Static_Assertion? Yannick Duchêne (Hibou57)
2013-07-23 18:43 ` Dmitry A. Kazakov
2013-07-23 18:57 ` Yannick Duchêne (Hibou57)
2013-07-23 20:13 ` Dmitry A. Kazakov
2013-07-23 21:46 ` Georg Bauhaus [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox