Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!bloom-beacon!apple!bionet!agate!pasteur!ames!husc6!xait!g-rh From: g-rh@XAIT.Xerox.COM (Richard Harter) Newsgroups: comp.lang.c Subject: Implementations of char manipulation macros Message-ID: <35373@XAIT.Xerox.COM> Date: 21 Oct 88 16:54:56 GMT References: <10508@dartvax.Dartmouth.EDU> <7594@bloom-beacon.MIT.EDU> Reply-To: g-rh@XAIT.Xerox.COM (Richard Harter) Organization: Xerox Corporation, Cambridge, Massachusetts Lines: 22 In article <7594@bloom-beacon.MIT.EDU> scs@adam.pika.mit.edu (Steve Summit) writes: ... long amusing article on character manipulation macros ... ---- Having been burnt a few times on various such implementations I ended up coding them myself using tables (a caveat being that I usually am in a situation where speed is more important than memory). I.e. the relevant macro is something like #define mytoupper(c) casemap[(c)&0xff] where casemap is an array of 256 chars with the lowers mapping to uppers and the rest mapping to themselves. It is not, perhaps, a terribly elegant approach, but it works and it doesn't leave you at the mercy of surprises in system routine implementations. -- In the fields of Hell where the grass grows high Are the graves of dreams allowed to die. Richard Harter, SMDS Inc.