comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Legit Warnings or not
Date: Sat, 23 Jul 2011 10:26:40 -0400
Date: 2011-07-23T10:26:40-04:00	[thread overview]
Message-ID: <wccmxg5ax9b.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: j0d4gl$oqc$1@munin.nbi.dk

"Randy Brukardt" <randy@rrsoftware.com> writes:

> Right, but I personally consider this a bug. The bug is in the Ada market 
> (and ACATS) in that implementations that do this by default are allowed --  
> it's not a bug in the Ada standard or a bug with GNAT (this is commonly 
> accepted -- by everyone other than me) behavior.

No, not everyone other than you.  There are lots of folks who agree
with you on this point.

>>> Is this warnings legitimate? If yes, why line 8 is OK. Otherwise,
>>> should it be a bug?
>>
>> It's not a bug.  An object of type Warned_Person might need huge amounts
>> of memory, so Storage_Error might well be raised.
>
> And that to me is a bug. It's not that hard to implement on-demand 
> allocation if the object turns out to be huge.
>
> I understand the requirements to avoid secondary allocation and the like, 
> and it makes perfect sense to me for this behavior to occur when certain 
> restrictions are in place. But it doesn't make sense to me for this behavior 
> to be the default. It makes Ada less useful than it otherwise would be, and 
> often forces programmers to use access types when they otherwise would not 
> need them. The fewer explicit access types in a program, the better!!

Pragma Restrictions is one of my favorite features.  I'd be perfectly
happy if the language had all sorts of features that require implicit
pointers and implicit heap allocation, so long as there's a Restriction
to turn that off.  And maybe also a feature to control which storage
pool is used.  For example, I think "X : String;" should be allowed,
both as a stand-alone variable and as a record component.
And "array (...) of String".

But none of that is allowed in Ada, which makes me think the original
designers went to a lot of trouble to avoid implicit heap allocation,
which makes me lean toward the "allocate-the-max" implementation
for defaulted-discrims.  But I do have some sympathy for the opposite
view.

I also think all Ada compilers should do it the same way.  Perhaps if
Ada 83 had had some Implementation Requirement/Advice pushing in one
or the other direction, that would have happened.  It's "just an
efficiency issue" (wasted space, versus wasted alloc/dealloc time),
but it's such a huge one that in practice it's really a functionality
issue.

- Bob



  reply	other threads:[~2011-07-23 14:26 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-20 22:30 Legit Warnings or not Anh Vo
2011-07-20 23:16 ` Robert A Duff
2011-07-21 18:43   ` Anh Vo
2011-07-23  0:26   ` Randy Brukardt
2011-07-23 14:26     ` Robert A Duff [this message]
2011-07-21  2:37 ` Jeffrey Carter
2011-07-21  9:50   ` Brian Drummond
2011-07-21 14:39     ` Dmitry A. Kazakov
2011-07-23  0:36       ` Randy Brukardt
2011-07-23  9:03         ` Dmitry A. Kazakov
2011-07-23 11:07           ` Simon Wright
2011-07-23 11:21             ` Dmitry A. Kazakov
2011-07-26 21:25           ` Randy Brukardt
2011-07-27  7:45             ` Dmitry A. Kazakov
2011-07-28  0:37               ` Randy Brukardt
2011-07-28  9:22                 ` Dmitry A. Kazakov
2011-07-28 14:22                   ` Robert A Duff
2011-07-28 14:41                     ` Dmitry A. Kazakov
2011-07-28 15:10                       ` Robert A Duff
2011-07-28 17:05                         ` Dmitry A. Kazakov
2011-07-28 23:32                           ` Randy Brukardt
2011-07-28 23:48                   ` Randy Brukardt
2011-07-29  6:57                     ` Simon Wright
2011-07-29 18:56                       ` Jeffrey Carter
2011-07-30  0:13                       ` Randy Brukardt
2011-07-29  7:41                     ` Dmitry A. Kazakov
2011-07-30  0:17                       ` Randy Brukardt
2011-07-30  8:27                         ` Dmitry A. Kazakov
2011-08-01 22:12                           ` Randy Brukardt
2011-08-02 10:01                             ` Dmitry A. Kazakov
2011-08-02 21:30                               ` Randy Brukardt
2011-08-03  9:01                                 ` Dmitry A. Kazakov
2011-08-03 20:35                                   ` Randy Brukardt
2011-08-04  8:11                                     ` Dmitry A. Kazakov
2011-08-05 23:57                                       ` Randy Brukardt
2011-08-06  8:23                                         ` Dmitry A. Kazakov
2011-08-08 21:30                                           ` Randy Brukardt
2011-07-23 14:32         ` Robert A Duff
2011-07-26 21:32           ` Randy Brukardt
2011-07-21 15:28     ` Adam Beneschan
2011-07-21 15:41       ` Robert A Duff
2011-07-21 20:12         ` Adam Beneschan
2011-07-23  0:31           ` Randy Brukardt
2011-07-21 17:40     ` Jeffrey Carter
2011-07-21 21:30       ` Brian Drummond
2011-07-21 21:54         ` Adam Beneschan
2011-07-22 10:16           ` Brian Drummond
2011-07-22 14:54             ` Adam Beneschan
2011-07-23  0:46             ` Randy Brukardt
2011-07-23  0:42         ` Randy Brukardt
2011-07-23  9:20           ` Niklas Holsti
2011-08-04  5:56             ` David Thompson
2011-07-23  9:24           ` Dmitry A. Kazakov
2011-07-23 12:36           ` Brian Drummond
2011-07-21 15:13   ` Robert A Duff
2011-07-23  0:52     ` Randy Brukardt
2011-07-23 14:48       ` Robert A Duff
2011-07-21 14:17 ` anon
replies disabled

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