comp.lang.ada
 help / color / mirror / Atom feed
* Re: How to get a compilation error
@ 2001-11-16  8:23 Gautier Write-only-address
  0 siblings, 0 replies; 13+ messages in thread
From: Gautier Write-only-address @ 2001-11-16  8:23 UTC (permalink / raw)
  To: comp.lang.ada

>From: "Jean-Pierre Rosen" <rosen@adalog.fr>

>To get an error, do the following:
>subtype Assert is boolean range True..True;
>Check : constant := Assert'Pos(96 rem Chunk_Bits = 0)
>
>Since Check is a named number, an invalid value will result in a compile 
>time error (new in 95).

Interesting to observe that neither GNAT 3.13p nor OA 7.2.1
says anything against
------------------------------------------------------
procedure xxx is

  subtype Assert is Boolean range True..True;
  Check1 : constant := Assert'Pos(True) ;
  Check2 : constant := Assert'Pos(False) ;

begin
  null;
end;
------------------------------------------------------
;-)
______________________________________________________
Gautier  --  http://www.mysunrise.ch/users/gdm/e3d.htm

NB: Do not answer to sender address, visit the Web site!
    Ne r�pondez pas � l'exp�diteur, visitez le site ouaibe!


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp




^ permalink raw reply	[flat|nested] 13+ messages in thread
* How to get a compilation error
@ 2001-11-15 14:16 Wilhelm Spickermann
  2001-11-15 15:06 ` Martin Dowie
  0 siblings, 1 reply; 13+ messages in thread
From: Wilhelm Spickermann @ 2001-11-15 14:16 UTC (permalink / raw)
  To: comp.lang.ada

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?

Wilhelm





^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2001-11-17 11:32 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <mailman.1005975714.13778.comp.lang.ada@ada.eu.org>
2001-11-17 11:32 ` How to get a compilation error Preben Randhol
2001-11-16  8:23 Gautier Write-only-address
  -- strict thread matches above, loose matches on Subject: below --
2001-11-15 14:16 Wilhelm Spickermann
2001-11-15 15:06 ` Martin Dowie
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox