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.1 required=5.0 tests=BAYES_00, PP_MIME_FAKE_ASCII_TEXT autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,47bb539f07b52c30 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-11-15 07:03:38 PST From: "Martin Dowie" Newsgroups: comp.lang.ada References: Subject: Re: How to get a compilation error Date: Thu, 15 Nov 2001 15:06:41 -0000 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 NNTP-Posting-Host: ed125012.sd.edinbr.gmav.gecm.com Message-ID: <3bf3d68c$1@pull.gecm.com> X-Trace: 15 Nov 2001 14:51:56 GMT, ed125012.sd.edinbr.gmav.gecm.com Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!dispose.news.demon.net!demon!diablo.theplanet.net!btnet-peer!btnet-peer0!btnet-feed5!btnet!newreader.ukcore.bt.net!pull.gecm.com!ed125012.sd.edinbr.gmav.gecm.com Xref: archiver1.google.com comp.lang.ada:16567 Date: 2001-11-15T15:06:41+00:00 List-Id: "Wilhelm Spickermann" 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.