Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!rutgers!bellcore!faline!thumper!ulysses!ggs From: ggs@ulysses.homer.nj.att.com (Griff Smith) Newsgroups: comp.lang.c Subject: Re: Array indexing vs. pointers... Summary: wait until ANSII C Message-ID: <10703@ulysses.homer.nj.att.com> Date: 7 Oct 88 00:04:16 GMT References: <836@proxftl.UUCP| <3105@hubcap.UUCP> <1700@dataio.Data-IO.COM> <171@umigw.MIAMI.EDU> Distribution: na Organization: AT&T Bell Laboratories, Murray Hill Lines: 43 In article <171@umigw.MIAMI.EDU>, steve@umigw.MIAMI.EDU (steve emmerson) writes: [my original deleted] > Nonsense. Use instead: > #define EPUTS(msg) (void)fputs(msg, stderr) > EPUTS("Usage: sltread [options] input-drive-name\n"); > EPUTS("Options: [-l] [-s] [-v] [-x] [-z] [-t tape-volume-number]\n"); > EPUTS(" [-d dataset-name] [-n dataset-number]\n"); > EPUTS(" [-i ignore-count] [-r record-count]\n"); > > This has all the advantages -- and none of the disadvantages -- of the other. I'm still not crazy about using fputs as an efficiency hack, but this seems to be on the right track. > In ANSII-C you could even have the macro append the newline. If I remember correctly, I can avoid the formatting problem completely in ANSII C and avoid silly macros: (void) fprintf(stderr, "Usage: sltread [options] input-drive-name\n" "Options: [-l] [-s] [-v] [-x] [-z] [-t tape-volume-number]\n" " [-d dataset-name] [-n dataset-number]\n" " [-i ignore-count] [-r record-count]\n" ); > Don't write vulnerable code (at least not without *very* good reason). I try not to. A similar note to the other side: don't make gratuitous changes to other people's code without a good reason. I have been burned several times by having something break because someone else "improved" it. In one case I failed to add a comment to explain why a fairly complicated addition was necessary; someone else decided that it was ugly and stripped it. In another case the comment was there, and ignored. > -- > Steve Emmerson Inet: steve@umigw.miami.edu [128.116.10.1] -- Griff Smith AT&T (Bell Laboratories), Murray Hill Phone: 1-201-582-7736 UUCP: {most AT&T sites}!ulysses!ggs Internet: ggs@ulysses.att.com