Implementations of char manipulation macros

Richard Harter g-rh at XAIT.Xerox.COM
Sat Oct 22 02:54:56 AEST 1988


In article <7594 at bloom-beacon.MIT.EDU> scs at 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.



More information about the Comp.lang.c mailing list