comp.lang.ada
 help / color / mirror / Atom feed
* Question about 'valid
@ 2001-03-20 16:23 Peter Amey
  2001-03-20 19:03 ` Mark Lundquist
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Peter Amey @ 2001-03-20 16:23 UTC (permalink / raw)



Can I ask for the collected wisdom on the following please:

Given X : T;

If X'Valid is true and X is scalar is it always true that:

X in T;
X >= T'First;
X <= T'Last;

If the answer is yes then is it still true if T is an enumeration type
with a representation clause which leads to holes in its representation.

I am currently very interested in validating aribitrary bit patterns
that arrive via memory mapped ports and want to really understand the
role of 'valid in these cases.

TIA

Peter

-- 
---------------------------------------------------------------------------   
      __         Peter Amey, Product Manager
        )                    Praxis Critical Systems Ltd
       /                     20, Manvers Street, Bath, BA1 1PX
      / 0        Tel: +44 (0)1225 466991
     (_/         Fax: +44 (0)1225 469006
                 http://www.praxis-cs.co.uk/

--------------------------------------------------------------------------



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

* Re: Question about 'valid
  2001-03-20 16:23 Question about 'valid Peter Amey
@ 2001-03-20 19:03 ` Mark Lundquist
  2001-03-20 19:44 ` David C. Hoos, Sr.
  2001-03-29 23:56 ` Robert A Duff
  2 siblings, 0 replies; 5+ messages in thread
From: Mark Lundquist @ 2001-03-20 19:03 UTC (permalink / raw)



Peter Amey <pna@praxis-cs.co.uk> wrote in message
news:3AB78417.236D1AFF@praxis-cs.co.uk...
>
> Can I ask for the collected wisdom on the following please:
>
> Given X : T;
>
> If X'Valid is true and X is scalar is it always true that:
>
> X in T;
> X >= T'First;
> X <= T'Last;
>

Yes.

> If the answer is yes then is it still true if T is an enumeration type
> with a representation clause which leads to holes in its representation.

Yes.

-- mark

P.S.  Can you explain what that little ASCII graphic is in your signature
footer?  I've always wondered about that!  To me, it looks like a
saxophone...
:-)

> --------------------------------------------------------------------------
-
>       __         Peter Amey, Product Manager
>         )                    Praxis Critical Systems Ltd
>        /                     20, Manvers Street, Bath, BA1 1PX
>       / 0        Tel: +44 (0)1225 466991
>      (_/         Fax: +44 (0)1225 469006
>                  http://www.praxis-cs.co.uk/
>
> --------------------------------------------------------------------------















%%%





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

* Re: Question about 'valid
  2001-03-20 16:23 Question about 'valid Peter Amey
  2001-03-20 19:03 ` Mark Lundquist
@ 2001-03-20 19:44 ` David C. Hoos, Sr.
  2001-03-29 23:56 ` Robert A Duff
  2 siblings, 0 replies; 5+ messages in thread
From: David C. Hoos, Sr. @ 2001-03-20 19:44 UTC (permalink / raw)



"Peter Amey" <pna@praxis-cs.co.uk> wrote in message
news:3AB78417.236D1AFF@praxis-cs.co.uk...
>
> Can I ask for the collected wisdom on the following please:
>
> Given X : T;
>
> If X'Valid is true and X is scalar is it always true that:

'Valid is defined ONLY for Scalar types.

>
> X in T;
> X >= T'First;
> X <= T'Last;

Yes
>
> If the answer is yes then is it still true if T is an enumeration type
> with a representation clause which leads to holes in its representation.

Yes.

>
> I am currently very interested in validating aribitrary bit patterns
> that arrive via memory mapped ports and want to really understand the
> role of 'valid in these cases.
>
> TIA
>
> Peter
>
> --
> --------------------------------------------------------------------------
-
>       __         Peter Amey, Product Manager
>         )                    Praxis Critical Systems Ltd
>        /                     20, Manvers Street, Bath, BA1 1PX
>       / 0        Tel: +44 (0)1225 466991
>      (_/         Fax: +44 (0)1225 469006
>                  http://www.praxis-cs.co.uk/
>
> --------------------------------------------------------------------------







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

* Re: Question about 'valid
  2001-03-20 16:23 Question about 'valid Peter Amey
  2001-03-20 19:03 ` Mark Lundquist
  2001-03-20 19:44 ` David C. Hoos, Sr.
@ 2001-03-29 23:56 ` Robert A Duff
  2001-03-30  3:41   ` Ken Garlington
  2 siblings, 1 reply; 5+ messages in thread
From: Robert A Duff @ 2001-03-29 23:56 UTC (permalink / raw)


Peter Amey <pna@praxis-cs.co.uk> writes:

> Given X : T;
> 
> If X'Valid is true and X is scalar is it always true that:
> 
> X in T;
> X >= T'First;
> X <= T'Last;

Yes.

> If the answer is yes then is it still true if T is an enumeration type
> with a representation clause which leads to holes in its representation.

Yes.  But I would be a little bit wary of compiler bugs in that area.

> I am currently very interested in validating aribitrary bit patterns
> that arrive via memory mapped ports and want to really understand the
> role of 'valid in these cases.

I would avoid hole-y enums for this purpose, and just use integer types
that happen to have no extra values (eg "mod 2**32" or whatever).

- Bob



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

* Re: Question about 'valid
  2001-03-29 23:56 ` Robert A Duff
@ 2001-03-30  3:41   ` Ken Garlington
  0 siblings, 0 replies; 5+ messages in thread
From: Ken Garlington @ 2001-03-30  3:41 UTC (permalink / raw)


"Robert A Duff" <bobduff@world.std.com> wrote in message
news:wcclmpo86yd.fsf@world.std.com...
: Peter Amey <pna@praxis-cs.co.uk> writes:

: > I am currently very interested in validating aribitrary bit patterns
: > that arrive via memory mapped ports and want to really understand the
: > role of 'valid in these cases.
:
: I would avoid hole-y enums for this purpose, and just use integer types
: that happen to have no extra values (eg "mod 2**32" or whatever).

Oh, I hope not. I was a big supporter of 'Valid precisely because we always
had to do such annoying workarounds in Ada83...





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

end of thread, other threads:[~2001-03-30  3:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-03-20 16:23 Question about 'valid Peter Amey
2001-03-20 19:03 ` Mark Lundquist
2001-03-20 19:44 ` David C. Hoos, Sr.
2001-03-29 23:56 ` Robert A Duff
2001-03-30  3:41   ` Ken Garlington

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