How to write an 8-bit clean program

Martin Minow minow at mountn.dec.com
Sun Feb 11 13:15:43 AEST 1990


In article <1990Feb10.151053.16702 at is.uu.no> ra at is.uu.no (Robert Andersson)
asks for ideas regarding 8-bit character sets.
>
>It seems you lose in either case.
>Opinions?
>-- 
Unfortunately, about all you can do is to sprinkle casts (char *) to
(unsigned char *) or (void *) throughout your program.  You can make
this slightly more palatible by typedefs, such as
	typedef unsigned char	byte;
	typedef byte		*string;
but you still have to tiptoe around lint.  If you have an Ansi-complient
compiler, you can cheat by defining function arguments (and string
pointers) as "void *".

A more subtle problem is that you must make sure that comparison
routines such as strcmp and the more complicated regular-expression
routines work correctly for 8-bit characters.

Martin Minow
minow at thundr.enet.dec.com



More information about the Comp.lang.c mailing list