comp.lang.ada
 help / color / mirror / Atom feed
From: Pi <pi3_1415926536@yahoo.ca>
Subject: Re: How to get a compilation error
Date: Fri, 16 Nov 2001 05:22:34 -0500
Date: 2001-11-16T05:22:34-05:00	[thread overview]
Message-ID: <8o5J7.21146$va4.3735578@news20.bellglobal.com> (raw)
In-Reply-To: 9t2i83$7j2$1@s1.read.news.oleane.net

Jean-Pierre Rosen wrote :

> 
> "Wilhelm Spickermann" <wilhelm.spickermann@t-online.de> a �crit dans le
> message news: mailman.1005881899.15799.comp.lang.ada@ada.eu.org...
> >> 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).
> >
> >Hmm, I didn�t get a compilation error with gnat and I think
> >thats correct. 0 is a valid value for Check and False is a valid
> >parameter for Assert�POS as it takes Assert�BASE parameters
> >according to ARM 3.5.5(3).
> That's right... try:
> Check : constant := Assert'Pos(Assert(96 rem Chunk_Bits = 0))
> 

or

Check : constant Boolean := Boolean'Pred(96 rem Chunk_Bits = 0);

or 

Check : constant := Boolean'Pos(Boolean'Pred(96 rem Chunk_Bits = 0));

no need for an Assert-subtype ;-)
Only that Check will always be false when it compiles.

TMTOWTDI

-- 
3,14159265359




  parent reply	other threads:[~2001-11-16 10:22 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
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 [this message]
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