From: bbrown@infonode.ingr.com (Bailey Brown) Subject: Re: Do we have an ``index'' function? Date: 6 Oct 1992 00:17:00 GMT
lm@slovax.Eng.Sun.COM (Larry McVoy) writes:
>Here are some standard BSD -> SysV mappings. Maybe someobody wants to take
>these and start a bsd.h? I'm sure there are many more.
> #define index strchr
> #define rindex strrchr
Please don't do this. What if you have a struct with a member
called "index"? You get foo->strchr, which causes an error if
you include the file that defines index after the file which
defines the struct. It is better to do the following:
#define index(s, c) strchr(s, c)
#define rindex(s, c) strrchr(s, c)
============
Bailey Brown "Above all else, confusion reigns."
Intergraph Corporation
bbrown@casca.b11.ingr.com Procol Harum