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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,703c4f68db81387d X-Google-Thread: 109fba,703c4f68db81387d X-Google-Thread: 115aec,703c4f68db81387d X-Google-Thread: f43e6,703c4f68db81387d X-Google-Attributes: gid103376,gid109fba,gid115aec,gidf43e6,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!proxad.net!newsfeed.stueberl.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.arcor.de!news.arcor.de!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Teaching new tricks to an old dog (C++ -->Ada) Newsgroups: comp.lang.ada,comp.lang.c++,comp.realtime,comp.software-eng User-Agent: 40tude_Dialog/2.0.14.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <4229bad9$0$1019$afc38c87@news.optusnet.com.au> <1110032222.447846.167060@g14g2000cwa.googlegroups.com> <871xau9nlh.fsf@insalien.org> <3SjWd.103128$Vf.3969241@news000.worldonline.dk> <87r7iu85lf.fsf@insalien.org> <1110052142.832650@athnrd02> <1110284070.410136.205090@o13g2000cwo.googlegroups.com> <395uqaF5rhu2mU1@individual.net> <112rs0bdr2aftdf@corp.supernews.com> Date: Tue, 8 Mar 2005 20:31:52 +0100 Message-ID: <1inxxr988rxgg$.1w9dedak41k89.dlg@40tude.net> NNTP-Posting-Date: 08 Mar 2005 20:31:49 MET NNTP-Posting-Host: 0c336fbb.newsread4.arcor-online.net X-Trace: DXC=KhfM?@VT;TE[T26?78J:ejgIfPPldDjW\KbG]kaMHGSi?jHD8GO@FVdNEhFN_aC[6LHn;2LCVNCOgUkn_?_YOD\WW9GEV\GF X-Complaints-To: abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:8877 comp.lang.c++:44648 comp.realtime:1076 comp.software-eng:4630 Date: 2005-03-08T20:31:49+01:00 List-Id: On Tue, 08 Mar 2005 13:33:33 -0500, CTips wrote: > How easy is it to build an arena allocator in Ada? It is trivial: type Object is ...; type Object_Ptr is access Object; for Object_Ptr'Storage_Pool use My_Arena; Here you are: Ptr : Object_Ptr := new Object; -- This allocates it in My_Arena Note that Object can still be allocated on the stack or in any other pool: type Object_Universal_Ptr is access all Object; This : Object; -- This allocates it on the stack That : Object_Universal_Ptr := new Object; -- This will be in the(a) default pool (in the heap) > Given a processor with load-word-locked and store-word-conditional, how > would I build an atomic increment function? Why should I have atomic increment function? Ada has native concurrency support. But if somebody would need that extremely low level thing as atomic integers, then: protected type Atomic_Integer is procedure Increment; private Value : Integer; end Atomic_Integer; -- Implementation protected body Atomic_Integer is procedure Increment is begin Value := Value + 1; end Increment; end Atomic_Integer; -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de