tech-userlevel archive

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

Re: using the interfaces in ctype.h



On Sun, 20 Apr 2008, Greg A. Woods; Planix, Inc. wrote:
> Indeed!  Some implementations were so lame they didn't include the
> mask in the implementation of the macro!

If the implementation masked the value before using it, then it would be
unable to distinguish EOF from UCHAR_MAX (typically '\377').  Anyway,
the onus falls on the caller to ensure that they don't pass invalid
values; otherwise the implementation is allowed to do anything at all.

> Oh oh, oops, the NetBSD implementations don't seem to include the mask
> either!  I didn't realized that!  So sad.  (Which may even mean they
> violate the standards implication that they be able to safely accept
> the value of EOF.

Huh?  The NETBSD implementations accept EOF.  Since masking inside the
implementation would violate the requirement to distinguish EOF from
UCHAR_MAX, it's good that NetBSD doesn't do that.

think that masking inside the implementation would be 

> FreeBSD, OpenBSD, and Darwin all seem to have much better
> implementations, though they are all using proper (inline) functions
> which makes it easier in some ways to do it right.)

I am mildly curious.  In what way are they "better"?

--apb (Alan Barrett)


Home | Main Index | Thread Index | Old Index