hi, all > I was just wondering why this change was made? It seems to be a backwards > step to me?
my intension is quite paranoia. changing uint8_t -> unsigned char / int16_t -> short is because _ctype_ / _tolower_tab_ / _toupper_tab_ in ctype.h (now splitted sys/ctype_bits.h) declared as unsigned char / short. ctype.h(rev1.29) -- http://tinyurl.com/365ycfq extern const unsigned char *_ctype_; extern const short *_tolower_tab_; extern const short *_toupper_tab_; but ctypeio.c read them from LC_CTYPE as uint8_t / int16_t and network endian and directly cast to unsigned char/short. ctypeio.c(rev1.11) -- http://tinyurl.com/22my4t8 if (fread((void *)ptr, sizeof(uint8_t), len, fp) != len) ... if (fread((void *)ptr, sizeof(int16_t), len, fp) != len) ... if (fread((void *)ptr, sizeof(int16_t), len, fp) != len) ... #if BYTE_ORDER == LITTLE_ENDIAN for (i = 1; i <= len; i++) { new_toupper[i] = ntohs(new_toupper[i]); new_tolower[i] = ntohs(new_tolower[i]); } #endif ... data->ctype_tab = (const unsigned char *)new_ctype; data->toupper_tab = (const short *)new_toupper; data->tolower_tab = (const short *)new_tolower; if the case, someone port to the machine that sizeof(unsigned char) != sizeof(uint8_t) or sizeof(short) != sizeof(int16_t), is*/to* function doesn't work correctlly. # such as NetBSD/pdp10(9bit char), or cray1(64bit char) > If you ever port to a 36-bit machine, you are going to have to lie and > define int32_t as 'int' anyway.... intN_t is not portable type, these are optimal: ISO/IEC9899:1999 7.18.1.1 3 These types are optional. However, if an implementation provides integer types with widths of 8, 16, 32, or 64 bits, no padding bits, and (for the signed types) that have a two’s complement representation, it shall define the corresponding typedef names. NetBSD/pdp10 seems that providing them by using gcc extension __attribute__((size N)). > The [u]int_leastN_t types may be useful in this sort of code. exactly, but it require C99 stdint.h(or sys/types.h). ctype.h should keep C90 namespace, i'm not willing to include it. P.S. i'm now attempting increase _ctype_ bits 8 -> 16 before branching netbsd-6. because these ancient code(delived from 4BSD) have two bugs: 1. _B bit desn't means isblank(3) but isprint(3) && !isgraph(3). so we have to provide real "isblank" bit, but there is no bit space left. 2. isprint(3) doesn't recognize some japanese half-width character and vietnamese's phonogram character, we have to provide "phonogram" bit too. i'll post patch to tech-userlevel@, this weekend or next week. very truly yours. -- Takehiko NOZAKI <tnoz...@netbsd.org>