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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 109fba,df854b5838c3e14 X-Google-Attributes: gid109fba,public X-Google-Thread: 1014db,df854b5838c3e14 X-Google-Attributes: gid1014db,public X-Google-Thread: 103376,df854b5838c3e14 X-Google-Attributes: gid103376,public X-Google-Thread: 10db24,fec75f150a0d78f5 X-Google-Attributes: gid10db24,public From: Bradd W. Szonye Subject: RE: ANSI C and POSIX (was Re: C/C++ knocks the crap out of Ada) Date: 1996/04/23 Message-ID: <01bb30e4.82f82d80$38c2b7c7@Zany.localhost>#1/1 X-Deja-AN: 151256055 references: <4kk9e1$he1@nntp.Stanford.EDU> <01bb2ed2.425fb900$65c2b7c7@Zany.localhost> <4lco1i$24i0@mule1.mindspring.com> organization: Netcom x-netcom-date: Tue Apr 23 2:11:20 AM CDT 1996 newsgroups: comp.lang.ada,comp.lang.c,comp.lang.c++,comp.edu Date: 1996-04-23T02:11:20-05:00 List-Id: On Sunday, April 21, 1996, Danette & Murray Root wrote... > on 20 Apr 1996 15:55:36 GMT, Bradd W. Szonye wrote: > > > =>encourage the code that works under all circumstances. Consider: > > =>for (size_t i = 0; i < 10; i++) do_stuff(); > > =>versus > > =>for (size_t i = 0; i != 10; i++) do_stuff(); > > while the gist of your diatribe made sense, this was silly. > Any 'programmer/software engineer/title of your choice' who can't tell the > difference between 'not equal' and 'is less than' is a moron, and deserves > his fate. Both code fragments I gave are legal and they work. In fact, they're both safe. The programmer who uses the second one is merely not being "defensive" and in fact the STL requires the second syntax for a lot of iterators. My point is that programmers who provide counts bigger than their buffers are relying on nitpicky aspects of the standard, just as programmers who test loops with "not equal" are relying on "nitpicky" aspects of that operator. In the loop case, programmers always use "defensive" code that will never break, while in the buffer case, too many programmers use "defenseless" code that may break if the data size changes.