Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!mailrus!uflorida!haven!mimsy!chris From: chris@mimsy.umd.edu (Chris Torek) Newsgroups: comp.lang.c Subject: Re: index and rindex question... Message-ID: <22236@mimsy.umd.edu> Date: 2 Feb 90 00:45:11 GMT References: <11716.25C6818B@urchin.fidonet.org> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 21 In article <11716.25C6818B@urchin.fidonet.org> Bob.Stout@p6.f506.n106.z1.fidonet.org (Bob Stout) writes: > Both the strchr() and strrchr() functions made it into the ANSI spec while >index() and rindex() didn't. I believe this was because the latter two >functions on some systems return an int offset of the character rather >than a pointer to it. Unless there are some *extremely* broken systems out there (this is always a possibility), there are no systems on which index() and rindex() return an int. index and rindex, wherever present, should be EXACTLY identical to strchr and strrchr, so that, e.g., #define index strchr #define strrchr rindex should work (if you have both in your C library). -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@cs.umd.edu Path: uunet!mimsy!chris