From: John Perry <john.perry@usm.edu>
Subject: Re: type definition for an integer with discrete range
Date: Sat, 30 Mar 2019 14:45:41 -0700 (PDT)
Date: 2019-03-30T14:45:41-07:00 [thread overview]
Message-ID: <0fbbff90-12a3-47e8-9993-1ea5f90bf201@googlegroups.com> (raw)
In-Reply-To: <b572b336-e634-48b8-99cd-f987bd5ab12e@googlegroups.com>
You wanted a compile-time error; would a warning do? I only have it from -20 to 20 for the sake of time & space, but a Static_Predicate does the trick.
{{{
pragma Assertion_Policy(Check);
procedure Main is
subtype Number is Integer with Static_Predicate =>
Number in -20 | -15 | -10 | -5 | 0 | 5 | 10 | 15 | 20;
A, B: Number;
begin
A := 10;
B := 12;
end Main;
}}}
prev parent reply other threads:[~2019-03-30 21:45 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-29 16:10 type definition for an integer with discrete range mario.blunk.gplus
2019-03-29 16:34 ` tranngocduong
2019-03-29 16:46 ` mario.blunk.gplus
2019-03-30 4:17 ` tranngocduong
2019-03-30 4:19 ` tranngocduong
2019-03-29 20:24 ` Simon Wright
2019-03-29 20:51 ` mario.blunk.gplus
2019-03-29 21:24 ` Simon Wright
2019-03-30 20:44 ` mario.blunk.gplus
2019-03-30 22:13 ` Jere
2019-04-01 6:59 ` mario.blunk.gplus
2019-04-01 15:52 ` AdaMagica
2019-04-01 16:27 ` Simon Wright
2019-04-01 16:41 ` AdaMagica
2019-03-29 21:57 ` Dmitry A. Kazakov
2019-03-30 21:45 ` John Perry [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