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:aed:20cd:: with SMTP id 71mr8781389qtb.86.1587249211963; Sat, 18 Apr 2020 15:33:31 -0700 (PDT) X-Received: by 2002:a9d:7343:: with SMTP id l3mr3040581otk.276.1587249211701; Sat, 18 Apr 2020 15:33:31 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!weretis.net!feeder7.news.weretis.net!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed9.news.xs4all.nl!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:33:31 -0700 (PDT) In-Reply-To: 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: <28c484ae-fd22-44e3-948e-904cebccf448@googlegroups.com> Subject: Re: Beginning Ada Programming, by Andrew T. Shvets (2020) From: Jere Injection-Date: Sat, 18 Apr 2020 22:33:31 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader01.eternal-september.org comp.lang.ada:58411 Date: 2020-04-18T15:33:31-07:00 List-Id: On Saturday, April 18, 2020 at 6:18:30 PM UTC-4, Luke A. Guest wrote: > On 18/04/2020 22:54, cantanima 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. > > I don't think it can, I think the new iterator for loops are for stl > containers only. I could be wrong though. C++ has had a lot of changes over the last decade or so. This example compiles and runs correctly: #include using namespace std; int main() { // your code goes here char message[] = "hello world\r\n"; int data[] = {0,1,2,3,4,5,6,7,8,9}; for(auto c : message){ cout << c; } for(auto num : data){ cout << num << ','; } cout << endl; return 0; } See it on ideone: https://ideone.com/db7cvr