On Fri, Sep 04, 2009 at 01:42:04PM +1000, Bruce Evans wrote:
> The patch is missing the corresponding text for wctype functions
> (argmuments of type wint_t generally give undefined behaviour unless
> their value is representable as a wchar_t or equal to the value of
> WEOF).  In FreeBSD, wint_t has the same type as wchar_t and that type
> is int, so bugs in this area are latent (unportable code might run
> on FreeBSD, and there might be problems with the sign bit and/or with
> WEOF being indistinguishable from a valid wide char encoding.

Yes, having the same note for wctype family will be nice too.

> It should be something like "if the value to be
> passed is represented as a signed char" ...  I don't know a good easy
> way to fix "must be cast ... to avoid sign-extension errors".  The
> value must be converted to one representable as an unsigned char to
> work, but that is not always possible, and blindly casting may give
> a wrong value.  

> Exotic machines include:

I think, "exotic machines" examples you mention already brokes too many
other aspects regarding to char manipulating, so nobody will really make
such machines with standard-compliance C compiler on them :)

> Sign extension for passing a signed char is not an error.  The error is
> passing a negative value.

Yes. Perhaps 'Never pass negative arg there, including sign-extended char' 
or something alike.

> Neither C99 nor POSIX gives any advice.  They just say that the behaviour
> is undefined if the value is not representable as an unsigned char or
> equal to the value of EOF.

Yes, I already mention that.

> % Index: lib/libc/locale/isrune.3
> % Index: lib/libc/locale/digittoint.3
> % Index: lib/libc/locale/isascii.3
> % Index: lib/libc/locale/toascii.3

Yes, those ones works with int. I don't pay attention to them in 
the whole patch :(

About other wording nuances mentioned in your reply, I don't have an 
opinion, everybody knows my English is poor :)

-- 
http://ache.pp.ru/
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to