[comp.lang.c] The high bit of a char is not a flag.

earleh@eleazar.dartmouth.edu (Earle R. Horton) (05/27/88)

I have found a bug in the program flex where the author used
the high bits of characters for an internal flag.  This made
the program unusable for scanning valid characters in two
systems I can think of, to wit the Macintosh and DEC multi-
nationals, and cost me three days of head-scratching.  Please
do not use this bit for a flag, or negate characters to flag
them.  Doing so seriously reduces portability of your code.

If you must negate or flag characters, please convert them to
type short first, and then back when you are done.  Diffs for
flex posted to comp.sources.unix.  Tested on Macintosh and
4.3 BSD VAX.
*********************************************************************
*Earle R. Horton, H.B. 8000, Dartmouth College, Hanover, NH 03755   *
*********************************************************************