Bruno Haible <[EMAIL PROTECTED]> writes: > It says that the _values_ of the characters are interpreted as > unsigned char. I.e. like this:
Sure, but a character, as used in the sense here, is a bit representation that fits in a byte (see section 3.7.1); it is not a 'char' value. The intent is that memcmp looks at all the bits of the underlying representation. See, for example, footnote 43 of section 6.2.6.1: It is possible for objects x and y with the same effective type T to have the same value when they are accessed as objects of type T, but to have different values in other contexts. In particular, if == is defined for type T, then x == y does not imply that memcmp(&x, &y, sizeof (T)) == 0. Furthermore, x == y does not necessarily imply that x and y have the same value; other operations on values of type T may distinguish between them. Here again, the intent is that memcmp(&x, &y, sizeof (T)) compares all the bits in the underlying representation. The only way to do that portably is via "unsigned char *".