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,147f221051e5a63d X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news4.google.com!feeder1-2.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: memory management in Ada: tedious without GC? Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.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: <4ddef8bf-b5b1-4d7e-b75b-386cd6c8402c@l17g2000pri.googlegroups.com> <482E8A9D.5040401@obry.net> <8640a12f-da99-435f-8eb6-372e175cd5b9@z72g2000hsb.googlegroups.com> <482F19CE.7060306@obry.net> <87d4nkzhtn.fsf@willow.rfc1149.net> <2545491.n7xu0MFufK@linux1.krischik.com> <143d9t4zvr3jh$.1iwejgp9vpckx$.dlg@40tude.net> <9dc4760f-66a2-4f02-b3c3-8183d6ffdf8a@x41g2000hsb.googlegroups.com> <1lhz8tibbai6x.1isxkju8q2n9q.dlg@40tude.net> Date: Mon, 19 May 2008 10:36:04 +0200 Message-ID: NNTP-Posting-Date: 19 May 2008 10:36:04 CEST NNTP-Posting-Host: 42c2f1e2.newsspool2.arcor-online.net X-Trace: DXC=`8JUV6=[34:LNKYb?b>076A9EHlD;3Yc24Fo<]lROoR18kF7enW;^6ZC`4IXm65S@:3>?2Rnk>5b@1d5 X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:225 Date: 2008-05-19T10:36:04+02:00 List-Id: On Sun, 18 May 2008 13:51:44 -0700 (PDT), Maciej Sobczak wrote: > On 18 Maj, 16:59, "Dmitry A. Kazakov" > wrote: > >>>> 1. Its body cannot be allocated on the stack. >> >>> What is "body"? >> >> Storage used to keep the array elements. > > From when should we care where it is? We don't want to care, it means to have the least strict requirements on the storage. It should be possible to allocate it in the task local storage, or in the storage having certain allocation policy. One implementation constraint which satisfies these requirements is that the object is contiguous. Maybe, one could relax it, but I don't see a good way to it. >>>> 2. It is not a proper type (requires parametrization) >> >>> Is it wrong? >> >> Yes. It has no values and no operations. > > Can I say that arrays in Ada also have no values and no operations > until they are parapeterized with element and index type (and > constrained)? Right, these are points 4-5 of my earlier post. >>>> 3. Optimization. I have doubts that small vectors could be passed by value, >>>> loops over them unrolled, values cached in registers, that static bounds >>>> checking could be enforced at compile time and skipped at run-time etc. >> >>> All of these can be done. >> >> Is there a C++ compiler that does this? > > You had doubts whether it *could* be done, not whether it *is* > done. :-) There is nothing fundamental that would prevent it. > Note that vector is a *standard* feature - so the compiler knows what > it does and how. Ah, that is the point. The compiler shall know if something is an array. In Ada, which "has arrays" the language tells the compiler - here is one. In C++, which "does not have arrays", it is the name of the template that should convey the idea. What happens if I modify or rename the template? This is an argument for having, not arrays, but their interfaces built-in in the language. Both Ada and C++ are wrong here. I don't understand why C++ advocates feel offended when somebody tells that C++ does not have arrays. They should be proud of this. C++ has better means for array interfaces than Ada has. These are not templates or vector<>, but operator[]. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de