From: "Martin Dowie" <martin.dowie@nospam.baesystems.com>
Subject: Re: How to get a compilation error
Date: Thu, 15 Nov 2001 15:06:41 -0000
Date: 2001-11-15T15:06:41+00:00 [thread overview]
Message-ID: <3bf3d68c$1@pull.gecm.com> (raw)
In-Reply-To: mailman.1005833842.603.comp.lang.ada@ada.eu.org
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 950 bytes --]
"Wilhelm Spickermann" <wilhelm.spickermann@t-online.de> wrote in message
news:mailman.1005833842.603.comp.lang.ada@ada.eu.org...
Hi,
I would like to get a compilation *error*, if some compile time
constant is not suitable for the algorithm in use. Example:
Chunk_Bits : constant :=
Integer'Min (32, System.Max_Binary_Modulus / 2);
type Check is (Checkitem1, Checkitem2);
for Check'SIZE use 1 - Integer'MIN (96 mod Chunk_Bits, 1);
The last two lines result in a compilation error, if and (I
hope) only if 96 is not a multiple of Chunk_Bits. That�s what I
want -- but it�s really ugly. Does anyone have something better?
Could try:
type A_Valid_Range is range 0 .. 0;
My_Check : constant A_Valid_Range :=
A_Valid_Range (96 mod (Integer'Min (32, System.Max_Binary_Modulus /
2)));
This will probably raise a warning rather than an error though.
Some compilers will let you specify that warning are to be
treated as errors.
next prev parent reply other threads:[~2001-11-15 15:06 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-11-15 14:16 How to get a compilation error Wilhelm Spickermann
2001-11-15 15:06 ` Martin Dowie [this message]
2001-11-15 15:09 ` Jean-Pierre Rosen
2001-11-15 17:38 ` Wilhelm Spickermann
2001-11-16 8:19 ` Jean-Pierre Rosen
2001-11-16 9:44 ` Wilhelm Spickermann
2001-11-16 10:22 ` Pi
2001-11-16 17:27 ` Wilhelm Spickermann
2001-11-15 23:49 ` martin.m.dowie
2001-11-16 9:05 ` Wilhelm Spickermann
2001-11-15 17:47 ` Wilhelm Spickermann
-- strict thread matches above, loose matches on Subject: below --
2001-11-16 8:23 Gautier Write-only-address
[not found] <mailman.1005975714.13778.comp.lang.ada@ada.eu.org>
2001-11-17 11:32 ` Preben Randhol
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox