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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f43e6,899fc98b2883af4a X-Google-Attributes: gidf43e6,public X-Google-Thread: 103376,583275b6950bf4e6 X-Google-Attributes: gid103376,public X-Google-Thread: 11232c,59ec73856b699922 X-Google-Attributes: gid11232c,public X-Google-Thread: 1108a1,59ec73856b699922 X-Google-Attributes: gid1108a1,public X-Google-Thread: fdb77,5f529c91be2ac930 X-Google-Attributes: gidfdb77,public X-Google-ArrivalTime: 2003-05-19 13:38:25 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!enews.sgi.com!sdd.hp.com!ihnp4.ucsd.edu!news.ucsd.edu!not-for-mail From: Dr Chaos Newsgroups: comp.lang.java.advocacy,comp.object,comp.lang.ada,misc.misc,comp.software-eng Subject: Re: Quality systems (Was: Using Ada for device drivers? (Was: the Ada mandate, and why it collapsed and died)) Followup-To: comp.lang.java.advocacy Date: Mon, 19 May 2003 20:38:06 +0000 (UTC) Organization: Univ of Calif San Diego Message-ID: References: <9fa75d42.0304230424.10612b1a@posting.google.com> <9fa75d42.0305091549.48b9c5d9@posting.google.com> <7507f79d.0305121629.5b8b7369@posting.google.com> <9fa75d42.0305130543.60381450@posting.google.com> <254c16a.0305140549.3a87281b@posting.google.com> <9fa75d42.0305141747.5680c577@posting.google.com> <254c16a.0305160425.3bb89749@posting.google.com> <1053091306.979352@master.nyc.kbcfp.com> <7vaddj8k3d.fsf@vlinux.voxelvision.no> <7v65o78gtv.fsf@vlinux.voxelvision.no> <1053352870.115958@master.nyc.kbcfp.com> NNTP-Posting-Host: lyapunov.ucsd.edu X-Trace: news1.ucsd.edu 1053376686 6591 132.239.222.85 (19 May 2003 20:38:06 GMT) X-Complaints-To: usenet@news1.ucsd.edu NNTP-Posting-Date: Mon, 19 May 2003 20:38:06 +0000 (UTC) User-Agent: slrn/0.9.7.4 (Linux) Xref: archiver1.google.com comp.lang.java.advocacy:64196 comp.object:63704 comp.lang.ada:37532 misc.misc:14292 comp.software-eng:19303 Date: 2003-05-19T20:38:06+00:00 List-Id: On Mon, 19 May 2003 10:01:10 -0400, Hyman Rosen wrote: > Ole-Hjalmar Kristensen wrote: >> A small typo, and the loop will probably not do what you want. > > I imagine that this is true of every programming language > ever invented. > >> What stops someone from modifying i inside the loop? > > Nothing. > >> Also, begin() and end() only applies to STL type containers, not to >> plain arrays. > > Godd C++ programmers don't use plain arrays. Remember, C++ isn't > Ada, where arrays are convenient to use :-) And if you insist, > > template > T *begin(T (&array)[N]) { return array; } > template > T *end(T (&array)[N]) { return array + N; } > template > char (&sizer(T (&)[N]))[N]; > Now if you have an array A, begin(A) and end(A) will give you > pointers to the beginning and end suitable for use as STL > iterators. This looks like some deep-guru C++ programming. I see templates instantiated by two parameters, T and N. How does "begin(A)" instantiate it with two parameters instead of one?