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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.182.24.8 with SMTP id q8mr2635442obf.25.1407856241019; Tue, 12 Aug 2014 08:10:41 -0700 (PDT) X-Received: by 10.50.97.74 with SMTP id dy10mr693407igb.1.1407856240914; Tue, 12 Aug 2014 08:10:40 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!h18no18889832igc.0!news-out.google.com!px9ni588igc.0!nntp.google.com!h18no18889827igc.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 12 Aug 2014 08:10:40 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=66.126.103.122; posting-account=KSa2aQoAAACOxnC0usBJYX8NE3x3a1Xq NNTP-Posting-Host: 66.126.103.122 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: A simple question about the "new" allocator From: Adam Beneschan Injection-Date: Tue, 12 Aug 2014 15:10:40 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:21682 Date: 2014-08-12T08:10:40-07:00 List-Id: On Monday, August 11, 2014 11:54:50 PM UTC-7, NiGHTS wrote: > With all default configurations using a typical Ada compiler, will the fo= llowing code run indefinitely without fail or will it eventually crash? >=20 >=20 >=20 > procedure main is=20 > Test : access Positive; > begin > loop > Test :=3D new Positive; > end loop;=20 > end main; > If this does crash, what would be another way to write this program so th= at it does not crash? I would prefer not to use Ada.Unchecked_Deallocation. I vote for procedure main is begin loop null; end loop; end main; which would have the same effect as your orignal code but without crashing.= Really, the question "what would be another way to write this program so = that it does not crash" makes no sense at all; before answering it, we woul= d need specifics about just *what* you want to do without crashing. For example, if you want "test :=3D new Positive" to automatically dealloca= te the previously allocated Positive, since it isn't referenced any more, t= here are various "smart pointer" packages out there that keep a reference c= ount. But the question as posted isn't answerable. -- Adam