comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@acm.org
Subject: Re: Beginer problem: variable array size
Date: Mon, 23 Sep 2002 19:53:42 GMT
Date: 2002-09-23T19:53:42+00:00	[thread overview]
Message-ID: <ajKj9.188815$Jo.66253@rwcrnsc53> (raw)
In-Reply-To: 1032804973.357894@master.nyc.kbcfp.com

>How very odd. You yourself posted a program which meets the OP's requirements.
  I lied.  He might accept it, but it doesn't actually meet the stated spec.
Of course no program could meet that spec.

>In the terms you describe above, can you tell me what the limits are
>of your program?
>> type List_Type is array (Integer range <>) of Integer;
  Clearly has a limit of Integer'range inputs.  If Integer'size = 16,
that's 65,536 inputs (if I understand correctly the rules for the lower
bound of a concatenation).  If Integer'size = 32, there's probably a limit
much smaller than 2**32 set by recursion stack growth.  I can't tell you
accurately what that might be without finding out more about how the stack
is used by the program as compiled on a particular system.
  The program used a quadratic sort.  Since it prints during the sort,
you could probably have a good size input before there was a noticeable,
non-IO, delay, but that would happen even on a reasonably fast (ca 2002)
machine when you got into a few million inputs.
  The lack of a literal number, or a comment saying the above, means
the limit is hidden from a quick scan - but there is a limit.

> There is a fundamental difference between a program which has a
> wired-in size limit and a program which is bound by available
> memory, or even available address space. For one thing, when the
> latter program is moved to a system with more resources, it will
> hndle larger inputs. The former program will be stuck at its limit
> until it's revised.
  I agree there's a big difference between a program with a literal
numeric constant as a limit and a program that adapts to the resources
available, and the latter is normally better.  But the former at least
documents clearly what the limit is.  The adaptable program should say
what its limits are, or how to calculate those limits on a particular
machine.  How often have you seen that, vs leaving it to experiment and
Constraint_Error or Storage_Error or "CPU time exceeded"?  It's like
failing to do error analysis for a numeric program, or using type Integer
rather than an explicitly declared type.  The sloppy approach is commonly
done (I don't claim purity myself), but it shouldn't be encouraged.



  reply	other threads:[~2002-09-23 19:53 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-15 14:53 Beginer problem: variable array size Nacho
2002-09-15 16:45 ` Larry Kilgallen
2002-09-15 16:16   ` Nacho
2002-09-15 16:26     ` Ludovic Brenta
2002-09-15 17:46     ` Jeffrey Carter
2002-09-15 18:27     ` Pascal Obry
2002-09-15 20:03     ` Larry Kilgallen
2002-09-17 14:22     ` Ted Dennison
2002-09-18 11:53       ` Marin David Condic
2002-10-02 15:08         ` Matthew Heaney
2002-10-03 12:17           ` Marin David Condic
2002-09-19  0:43     ` Robert A Duff
2002-09-19  1:25       ` Jeffrey Carter
2002-09-19 14:17       ` Hyman Rosen
2002-09-20  3:06       ` Munch
2002-09-20  4:49         ` Jim Rogers
2002-09-20  6:35         ` tmoran
2002-09-20 16:00           ` Pat Rogers
2002-09-20 16:07             ` Preben Randhol
2002-09-20 20:15               ` Pat Rogers
2002-09-20 12:11         ` Marin David Condic
2002-09-20 13:59           ` Larry Kilgallen
2002-09-20 14:55             ` Hyman Rosen
2002-09-20 16:10               ` Larry Kilgallen
2002-09-20 16:31               ` Warren W. Gay VE3WWG
2002-09-24 12:41                 ` Thomas Dickey
2002-09-21 10:44               ` Thomas Dickey
2002-09-23 13:37                 ` Hyman Rosen
2002-09-22 13:00               ` Marin David Condic
2002-09-26  3:37                 ` Kevin Cline
2002-09-26 12:42                   ` Marin David Condic
2002-09-22 12:49             ` Marin David Condic
2002-09-20 16:28           ` Warren W. Gay VE3WWG
2002-09-20 17:49             ` Hyman Rosen
2002-09-21  7:30               ` Preben Randhol
2002-09-23 13:41                 ` Hyman Rosen
2002-09-22  3:34               ` Ted Dennison
2002-09-22 13:18             ` Marin David Condic
2002-09-24 16:55               ` Warren W. Gay VE3WWG
2002-09-25 12:06                 ` Marin David Condic
2002-09-21 22:23           ` tmoran
2002-09-23 13:53             ` Hyman Rosen
2002-09-23 15:19               ` Chad R. Meiners
2002-09-23 16:00                 ` Hyman Rosen
2002-09-23 17:09               ` tmoran
2002-09-23 18:18                 ` Hyman Rosen
2002-09-23 19:53                   ` tmoran [this message]
2002-09-23 20:32                     ` Hyman Rosen
2002-09-23 20:10                 ` Dennis Lee Bieber
2002-09-23 23:09                   ` tmoran
2002-09-24  2:33                     ` Dennis Lee Bieber
2002-09-24 12:36               ` Marin David Condic
2002-10-02 15:13       ` Matthew Heaney
2002-09-19 20:25     ` Brian Gaffney
2002-09-17 10:20 ` Georg Bauhaus
2002-10-02 15:04 ` Matthew Heaney
2002-10-02 16:26   ` Preben Randhol
2002-10-02 19:53     ` Matthew Heaney
2002-10-03 12:31       ` Marin David Condic
2002-10-03 15:15         ` Matthew Heaney
2002-10-21 23:38           ` Matthew Heaney
2002-10-22 14:11     ` Matthew Heaney
replies disabled

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