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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Received: by 2002:ad4:45ae:: with SMTP id y14mr8975377qvu.145.1587249460340; Sat, 18 Apr 2020 15:37:40 -0700 (PDT) X-Received: by 2002:a9d:b85:: with SMTP id 5mr4331423oth.81.1587249460047; Sat, 18 Apr 2020 15:37:40 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!feeder1.feed.usenet.farm!feed.usenet.farm!tr2.eu1.usenetexpress.com!feeder.usenetexpress.com!tr3.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 18 Apr 2020 15:37:39 -0700 (PDT) In-Reply-To: <9ecb00e7-e677-4cec-80f7-3484116c871a@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: google-groups.googlegroups.com; posting-host=70.109.61.2; posting-account=QF6XPQoAAABce2NyPxxDAaKdAkN6RgAf NNTP-Posting-Host: 70.109.61.2 References: <87muca3vgd.fsf@nightsong.com> <57d49047-0a61-4d13-8822-d004732a3acc@googlegroups.com> <007895f7-b923-4267-9801-d0caaaa30838@googlegroups.com> <41ef6a77-3b14-43ff-b6ae-510000a33ad4@googlegroups.com> <9f2bfb05-fb5e-45cf-909e-53629b939da3@googlegroups.com> <229f9564-4f23-4b12-bea9-518ceda86a09@googlegroups.com> <9ecb00e7-e677-4cec-80f7-3484116c871a@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Beginning Ada Programming, by Andrew T. Shvets (2020) From: Jere Injection-Date: Sat, 18 Apr 2020 22:37:40 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader01.eternal-september.org comp.lang.ada:58412 Date: 2020-04-18T15:37:39-07:00 List-Id: On Saturday, April 18, 2020 at 5:54:49 PM UTC-4, cantani...@gmail.com wrote: > On Saturday, April 18, 2020 at 12:59:38 PM UTC-5, Jere wrote: > > Actually it does work on low level arrays in C++. It doesn't work > > on pointers to array elements however, which people often confuse > > with arrays (that's how people most often pass them to functions, > > but there are other methods). > > I didn't realize C++ had progressed to tracking how long a low-level array is, but in retrospect it's come along so much in terms of what you can do at compile-time that I should have tested before commenting. Thank you. > > regards > john perry C++ has always been able to track array size at compile time (the sizeof() operator worked correctly even back int he day as long as you used it on the array and not a pointer). Somewhere since c++11 (or maybe more recent) they added the auto looping and included low level arrays with it. The big problem remains however, is you cannot technically pass an array to a function as a bare parameter. If you pass it to a function as a pointer, it loses the length, which then kills the auto looping mechanism. There are ways around this, but generally C++ prefers that you use containers rather than raw arrays or pointers (similar to how Ada prefers containers over access types). So low level arrays still do have severe limitations even with the auto looping available. Hope that helps!