Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!ukma!gatech!ncar!umigw!steve From: steve@umigw.MIAMI.EDU (steve emmerson) Newsgroups: comp.lang.c Subject: Re: Array indexing vs. pointers... Message-ID: <171@umigw.MIAMI.EDU> Date: 6 Oct 88 12:35:12 GMT References: <836@proxftl.UUCP| <3105@hubcap.UUCP> <1700@dataio.Data-IO.COM> <8630@smoke.ARPA> <10699@ulysses.homer.nj.att.com> Reply-To: steve@umigw.miami.edu (steve emmerson) Followup-To: comp.lang.c Distribution: na Organization: University of Miami Lines: 28 In article <10699@ulysses.homer.nj.att.com> ggs@ulysses.homer.nj.att.com (Griff Smith) writes: > (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"); > >I grant that this is vulnerable to code hackers and naive >pretty-printers messing up the alignment. On the other hand, it is >easier to see how everything lines up. 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. In ANSII-C you could even have the macro append the newline. Don't write vulnerable code (at least not without *very* good reason). -- Steve Emmerson Inet: steve@umigw.miami.edu [128.116.10.1] SPAN: miami::emmerson (host 3074::) emmerson%miami.span@star.stanford.edu UUCP: ...!ncar!umigw!steve emmerson%miami.span@vlsi.jpl.nasa.gov "Computers are like God in the Old Testament: lots of rules and no mercy"