On Mon, Dec 6, 2010 at 21:22, Tito <[email protected]> wrote: > On Monday 06 December 2010 21:26:08 Nuno Lucas wrote: >> On Mon, Dec 6, 2010 at 17:07, Cathey, Jim <[email protected]> wrote: >> >> > > - } else if (*here >= ' ' && *here <= '~') { >> >> > > + } else if (*here >= ' ' && *here < 0x7f) { >> >> > > >> >> > > This makes it less readable. Why replace the char with a hex >> >> > value? >> >> > >> >> > It is less obvious that '~' is the last ASCII character. >> > >> > IMHO, it is equally un-obvious that ' ' is the _first_ ASCII >> > character, of the printables. If one wants to go all pedantic >> > on the code, isprint() might be better. But I would probably >> > have left it as the original author had, as a quoted character. >> >> Actually, to be really pedantic, one should not use '~'. >> Not every codepage has '~' as the character at position 126. >> >> As an example: ISO/IEC 646:1991 German [1], has 'ß' (LATIN SMALL >> LETTER SHARP S - u+223) at the position 126. > Hi, > So as I understand it, it would be better to use numerical values > rather than characters to catch all corner cases?
I would not mind the space character, as I don't know any encoding (since the PC era) that doesn't have it at the 32th position of the character table. On the other hand, the '~' is a character that can have different ordinal values, depending of the character encoding. So, if it was me, I would prefer using the 0x7f/0x7e constant for the job (to not introduce ambiguity), but I'm not particularly inclined either side. It's the style of the rest of the code that should force the rule. Regards, ~Nuno Lucas _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
