comp.lang.ada
 help / color / mirror / Atom feed
From: "Jean-Pierre Rosen" <rosen@adalog.fr>
Subject: Re: 'Valid, subtypes and constraint checking
Date: Fri, 26 Sep 2003 15:13:42 +0200
Date: 2003-09-26T15:13:42+02:00	[thread overview]
Message-ID: <52e1lb.bua.ln@skymaster> (raw)
In-Reply-To: bl18e1$6ot2h$1@ID-69815.news.uni-berlin.de

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1062 bytes --]


"Peter Amey" <peter.amey@praxis-cs.co.uk> a �crit dans le message de news:bl18e1$6ot2h$1@ID-69815.news.uni-berlin.de...
> Some guidance please to reduce the slight panic I am suffering from.
>
> When reading in values from an external device it is important to check
> that the value read is a valid representation for its type.  The read
> values are also considered volatile so each read returns a potentially
> different value.
> [...]

> (Horrible strawman solution: do an unchecked conversion of External_Port
> into Temp and then do the validity check).
>
Not a horrible solution. You cannot assume your value is a T until you have checked
for it!
As long as all you know is that it is a set of bits, put it in a variable appropriate for
sets of bits. *After* validity checking, you can consider it a T. And Unchecked_Conversion
is the appropriate tool for changing the view on a give set of bits.

-- 
---------------------------------------------------------
           J-P. Rosen (rosen@adalog.fr)
Visit Adalog's web site at http://www.adalog.fr





  reply	other threads:[~2003-09-26 13:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-26 11:41 'Valid, subtypes and constraint checking Peter Amey
2003-09-26 13:13 ` Jean-Pierre Rosen [this message]
2003-09-26 18:18 ` Jeffrey Carter
2003-09-26 21:48   ` Chad R. Meiners
2003-09-27  1:30 ` Robert I. Eachus
2003-09-29  7:27   ` 'Valid, subtypes and constraint checking - Thanks Peter Amey
2003-09-30  2:58     ` Robert I. Eachus
2003-09-30 12:45       ` Marin David Condic
2003-09-30 21:30         ` Robert I. Eachus
2003-10-01 12:44           ` Marin David Condic
replies disabled

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