comp.lang.ada
 help / color / mirror / Atom feed
From: rieachus@comcast.net
Subject: Re: Playing cards.
Date: Sat, 26 Mar 2016 14:51:07 -0700 (PDT)
Date: 2016-03-26T14:51:07-07:00	[thread overview]
Message-ID: <060566e9-c555-4eee-a40d-8ed338643d9e@googlegroups.com> (raw)
In-Reply-To: <72436e28-13a7-4580-9503-0bd7111f4bab@googlegroups.com>

> Is there a reason why not to use (Natural range <>)?

It seems like a simple question, but digging through my mind, I dug out why.

I have plans for this type, and all my plans involve indexes from 1 to n.  Someone else may have different plans, but that is their choice.  In my case though, I expect to do lots of arithmetic to arrive at the correct index.  Is it possible that some intermediate will have a zero or negative value?  Sure.  Should an Ada compiler try to do that gotcha range check?  No.  But if at some point there is a parameter or function return that should not be range checked, this works.

More, this tells the user of the package that any range checking will be bounds checking for a particular object.

  parent reply	other threads:[~2016-03-26 21:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-26 18:50 Playing cards rieachus
2016-03-26 20:46 ` Nasser M. Abbasi
2016-03-26 21:51 ` rieachus [this message]
2016-03-28 21:13   ` Randy Brukardt
2016-03-29  0:08     ` Dennis Lee Bieber
2016-03-29  3:29 ` rieachus
replies disabled

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