comp.lang.ada
 help / color / mirror / Atom feed
From: James_Rogers <jrogers>
Subject: Re: next "big" language?? (disagree)
Date: 1996/06/11
Date: 1996-06-11T00:00:00+00:00	[thread overview]
Message-ID: <4pk9q9$a9j@ss2.cs.mci.com> (raw)
In-Reply-To: 4pj7e0$fat@goanna.cs.rmit.EDU.AU


rav@goanna.cs.rmit.EDU.AU (++           robin) wrote:

>   Are you seriusly suggesting that EACH time the program
>is run that it be edited and recompiled?  And what
>happens -- as is often the case -- the size of the array
>changes DURING the run?

Now you are approaching the real problem.  Arrays are must
always have a specific size.  That size may be defined at
compile time or it may be det4rmined at run time using
dynamic allocation.  Either way a given instance of an array
does not change its size.  If this is not enough reason to
use some other more dynamic data structure such as a list or
a tree, then the common methods used with arrays include the
concept of declaring a size which is the largest expected for
current needs.  A subset of that array is typically used for
the problem at hand, wasting the remainder for future growth.

The point is that every array must be accompanied by some method
of indicating the specific subset of elements to be processed.
In C this means one typically either passes an array pointer and
a size parameter, or a special character is expected to be
embedded in the array to mark the end of useful data ( the NULL
character, for instance).

Ada allows a parameter to be expressed as an unconstrained array.
This means any size (within system limits) of array may be passed
as a parameter.  The array attributes 'First, 'Last, 'Range can then
be used to traverse the array passed to the subprogram.  Now, you
ask, how does a calling subprogram pass a specific array to the
subprogram expecting an unconstrained array.  Ada allows you to
pass a slice of an array.  For instance, if your predefined array
is defined as:

   example : array (1..10000) of integer;

and you want to pass elements 23 through 413 to a function producing
a total which uses an unconstrained array parameter, the following 
syntax is used:

   Total := sum(example(23..413));

In this case elements 23 through 413 are passed to function "sum".
Funciton "sum" sees an array of integer with 'First mapping to element
23 of array example.

No recompilation is necessary to change the slice sent to the function.
All that is necessary is to use variables in the slice syntax, instead
of constants as shown in the above example.

   
-- 
Jim Rogers

*********************************************
I would not say that my mind is filled with useless information.
The information is, however, amazingly inappropriate in most
circumstances.





  parent reply	other threads:[~1996-06-11  0:00 UTC|newest]

Thread overview: 100+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4p0fdd$4ml@news.atlantic.net>
1996-06-04  0:00 ` next "big" language?? (disagree) Peter Hermann
1996-06-04  0:00   ` The Amorphous Mass
1996-06-04  0:00     ` Robert Dewar
1996-06-06  0:00       ` Ken Garlington
1996-06-12  0:00       ` Help making ada pretty CSC Trusted Systems Group
1996-06-14  0:00         ` Sandy McPherson
1996-06-19  0:00         ` Ruediger Berlich
1996-06-04  0:00     ` next "big" language?? (disagree) Peter Hermann
1996-06-04  0:00       ` The Amorphous Mass
1996-06-05  0:00         ` Michael David WINIKOFF
1996-06-07  0:00           ` Robert Dewar
1996-06-05  0:00     ` Ian Ward
1996-06-05  0:00       ` The Amorphous Mass
1996-06-08  0:00         ` Robert Dewar
1996-06-08  0:00           ` The Amorphous Mass
1996-06-09  0:00             ` Robert Dewar
1996-06-08  0:00         ` Robert Dewar
1996-06-05  0:00   ` ++           robin
1996-06-05  0:00     ` Ian Ward
1996-06-05  0:00       ` Ian Ward
1996-06-06  0:00         ` Richard Riehle
1996-06-07  0:00           ` Robert Dewar
1996-06-10  0:00             ` Richard Riehle
1996-06-07  0:00           ` Richard Riehle
1996-06-08  0:00             ` O'Connor
1996-06-11  0:00           ` ++           robin
1996-06-11  0:00             ` David Weller
1996-06-11  0:00             ` Chris Warack <sys mgr>
1996-06-11  0:00             ` James_Rogers [this message]
1996-06-11  0:00               ` Kevin J. Weise
1996-06-11  0:00         ` ++           robin
1996-06-11  0:00           ` Ian Ward
1996-06-12  0:00             ` ++           robin
1996-06-12  0:00               ` Ian Ward
1996-06-11  0:00       ` Jon S Anthony
     [not found]   ` <4p60nk$imd@euas20.eua.ericsson.se>
     [not found]     ` <4p8lmq$oq7@goanna.cs.rmit.edu.au>
1996-06-11  0:00       ` ++           robin
1996-06-11  0:00         ` A. Grant
1996-06-12  0:00           ` ++           robin
1996-06-12  0:00             ` A. Grant
1996-06-14  0:00               ` Richard A. O'Keefe
1996-06-12  0:00           ` Robert Dewar
1996-06-17  0:00             ` A. Grant
1996-06-18  0:00               ` Robert Dewar
1996-06-24  0:00                 ` Robert I. Eachus
1996-06-26  0:00                   ` Norman H. Cohen
1996-06-19  0:00             ` Jon S Anthony
1996-06-20  0:00               ` Robert Dewar
1996-06-24  0:00                 ` Dale Stanbrough
1996-06-24  0:00                   ` Robert Dewar
1996-06-24  0:00                   ` Adam Beneschan
1996-06-24  0:00                   ` Lars Duening
1996-06-24  0:00                   ` hopkinc
1996-06-24  0:00                   ` Assertions (was: Re: next "big" language?? (disagree)) Robert A Duff
1996-06-24  0:00                     ` Robert Dewar
1996-06-25  0:00                       ` Robert A Duff
1996-06-28  0:00                         ` Robert Dewar
1996-06-24  0:00                     ` Assertions (a different intent?) Gary McKee
     [not found]                     ` <4qrljg$15l8@watnews1.watson.ibm.com>
1996-06-28  0:00                       ` Assertions (was: Re: next "big" language?? (disagree)) Robert Dewar
1996-06-26  0:00                   ` next "big" language?? (disagree) Marc C. Brooks
1996-06-26  0:00                   ` Marc C. Brooks
     [not found]                   ` <4qsbm7$r1s@Starbase.NeoSoft.COM>
1996-06-28  0:00                     ` "Assert"? "Assume"? (was: next "big" language?? (disagree)) Alexander Bunkenburg
1996-06-28  0:00                       ` Ian Collier
1996-07-01  0:00                     ` Cameron Laird
1996-06-24  0:00                 ` next "big" language?? (disagree) Keith Thompson
1996-06-25  0:00                   ` Robert A Duff
1996-06-25  0:00                   ` Simon Read
1996-06-24  0:00                 ` Adam Beneschan
1996-06-25  0:00                 ` Darin Johnson
1996-06-26  0:00                   ` Dale Stanbrough
1996-06-26  0:00                   ` A. Grant
1996-06-25  0:00                 ` Brian Nettleton @pulsar
1996-06-26  0:00                   ` Robert Dewar
1996-06-28  0:00                     ` Fergus Henderson
1996-06-28  0:00                       ` Robert Dewar
1996-06-30  0:00                         ` Fergus Henderson
1996-06-30  0:00                           ` Robert Dewar
1996-06-12  0:00         ` Richard A. O'Keefe
1996-06-12  0:00           ` ++           robin
1996-06-12  0:00             ` Richard A. O'Keefe
1996-06-13  0:00               ` ++           robin
1996-06-13  0:00               ` ++           robin
1996-06-12  0:00   ` Jon S Anthony
1996-06-14  0:00   ` Jon S Anthony
1996-06-15  0:00   ` Jon S Anthony
1996-06-18  0:00     ` Adam Beneschan
1996-06-18  0:00   ` Jon S Anthony
1996-06-28  0:00     ` Assertions (an heretic view) Michel Gauthier
1996-06-28  0:00       ` Robert A Duff
1996-06-28  0:00       ` Robert Dewar
1996-06-06  0:00 ` next "big" language?? (disagree) Dale Pontius
1996-06-11  0:00 ` Jon S Anthony
1996-06-12  0:00 ` Help making ada pretty Pedro de las Heras
1996-06-18  0:00 ` next "big" language?? (disagree) ++           robin
1996-06-07  0:00 Ian Ward
1996-06-08  0:00 ` O'Connor
1996-06-10  0:00   ` Matt Kennel
1996-06-11  0:00     ` Ian Ward
1996-06-12  0:00       ` Norman H. Cohen
1996-06-11  0:00     ` Robb Nebbe
1996-06-09  0:00 ` Robert Dewar
replies disabled

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