[PATCH]: Portability fixes
christos at zoulas.com
Wed Jan 28 20:42:36 UTC 2009
On Jan 28, 12:16pm, martinrb at google.com (Martin Buchholz) wrote:
-- Subject: Re: [PATCH]: Portability fixes
| Christos, thanks for the bug report.
| For low level code like this, it's almost always a mistake
| (my mistake, that is; I am the author)
| to use the locale-dependent functions like isdigit.
| Still, I am surprised to see a real failure with isdigit(negative char).
Well, the reason the standard says it is "undefined" it is to
support existing implementations that use arrays of bits to
implement the isfoo() functions. Like:
#define isfoo(a) (__ctype[(a)] & _FOO)
A negative index there could lead to a possible core-dump depending on
where __ctype happens to live, or treating as "foo" things that are not
because the locations before the ctype array contain random values.
All this is for implementations that have signed characters by default
| I prefer the following fix for UNIXProcess_md.c:
| (and would be willing to submit it on Christos' behalf)
| (I'm not going to comment on the changes to AddressImpl.c,
| except to suggest considering ASCII-specific functions as well.)
That change looks fine to me.
Thanks for the quick reply.
More information about the core-libs-dev