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: 108717,a7c8692cac750b5e X-Google-Thread: 103376,703c4f68db81387d X-Google-Attributes: gid108717,gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!newshub.sdsu.edu!cyclone.bc.net!snoopy.risq.qc.ca!msc1.onvoy!onvoy.com!news.mmm.com!not-for-mail From: Programmer Dude Newsgroups: comp.programming,comp.lang.ada Subject: Re: C: [] vs * (was: 10 rules for benchmarking (was Re: Teaching new tricks to an old dog (C++ -->Ada))) Date: Tue, 15 Mar 2005 18:08:45 -0600 Organization: Wrenn Productions, LTD Message-ID: References: <113394jjvppao64@corp.supernews.com> <1133s3qnmqmbjfb@corp.supernews.com> <4232a9f7$0$26552$9b4e6d93@newsread4.arcor-online.net> <11369p5jrcc6835@corp.supernews.com> Reply-To: Programmer Dude NNTP-Posting-Host: 169.10.86.157 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Newsreader: Forte Agent 2.0/32.652 Xref: g2news1.google.com comp.programming:17996 comp.lang.ada:9459 Date: 2005-03-15T18:08:45-06:00 List-Id: Arthur J. O'Dwyer writes: >>> I think regardless of CTips' and Jim's points in this thread, the original >>> code serves as an excellent argument against using [] in function headers; >>> the extra "documentation" is more than offset by the decline in >>> readability, as far as I'm concerned. >> >> Just as another datapoint, I feel exactly the opposite. I much prefer >> the [] notation to signify that the pointer refers to more than one of >> whatever it's pointing at. > > I agree that that's the implicit "semantics" of [] versus *; I just > find bar(int ai[]), with all those vertical things clustered so close > together, to be much harder on the eyes --- and that's a bigger negative > for me than the implicit "Look, an array!" semantics is a positive. > Maybe that was clear the first time around; I just want to make sure > we're on the same page. All totally clear! Might be font-related or screen-related or maybe just plain taste-related. (-:\ >>>> Treating the address of any int >>>> as the beginning of an array is a formula for buffer >>>> overflow, as is demonstrated in this example. >>> >>> This example does not appear to contain any buffer oveflow. >>> If you think it does, please point it out to me. I may have >>> missed something. >> >> Maybe not in this example, but let's be fair. He said that treating >> the address of *any* int is problematic. And it is. C cannot be >> called a "safe" language. Safety must be imposed by the programmer. > > Sure. But Jim said, "as is demonstrated in this example." That's > like saying, "Jumping a motorcycle across a canyon is dangerous > because you could fall to your death, as demonstrated by Evel > Knievel."[1] > > -Arthur, > daredevil > > [1] - (who has /not/ fallen to his death, as of this posting, which > shows why Jim's statement IMO was either misleading or indicative of > a misapprehension) Right (although one can argue that his stunts do indeed--regardless of their success--demonstrate the danger...evidenced by the preparations, emergancy vehicles present (and no doubt constant "don't try this at home" warnings :-)). And I just choose to focus on the meat rather than the wrapping.