From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,5d4ade2fd8fd67c6 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!news.glorb.com!solaris.cc.vt.edu!news.vt.edu!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Legit Warnings or not Date: Sat, 23 Jul 2011 10:26:40 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <531193e0-3305-4292-9ed8-0176226c1d00@x12g2000yql.googlegroups.com> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls6.std.com 1311431200 1852 192.74.137.71 (23 Jul 2011 14:26:40 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Sat, 23 Jul 2011 14:26:40 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:UVTZF8UVh2iAYGFqmdTUz/dH0+A= Xref: g2news1.google.com comp.lang.ada:20323 Date: 2011-07-23T10:26:40-04:00 List-Id: "Randy Brukardt" 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