Array indexing vs. pointers...
Griff Smith
ggs at ulysses.homer.nj.att.com
Fri Oct 7 10:04:16 AEST 1988
In article <171 at umigw.MIAMI.EDU>, steve at 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 at 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 at ulysses.att.com
More information about the Comp.lang.c
mailing list