[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] iscntrl(EOF)



On Tue, Mar 07, 2000 at 04:44:30PM +0100, Andreas Schwab wrote:
> |> If so I would have to surrender and arrange for EOF not being a control
> |> character whereas 255 (UCHAR_MAX) would be one.  But I don't like that
> |> because a construct like
> |> 
> |> 	if (iscntrl (c))
> |> 		cast_it ();
> |> 
> |> would fail then for c == EOF.
> 
> What does UCHAR_MAX have to do with EOF?  They are distinct values.

Sure, they are, but in <ctype.h>:

#define iscntrl(c) (_ctype[(unsigned char) (c)] & _CTc)

If UCHAR_MAX (255) and EOF (-1) should produce different results I have to
use a macro that evaluates its arguments twice (at least for non-gcc
compilers).

Hm, maybe it is cleverer to allow negative subscripts into the _ctype
array instead and remove the cast to unsigned char.

Ciao

Guido
-- 
http://stud.uni-sb.de/~gufl0000/
mailto:guido@freemint.de