It looks to me like isalpha
is failing an assertion. Most likely (unsigned)(c + 1) <= 256
is the expression that is being asserted. It looks like this assertion is trying to ensure the value of c
falls within [0, 255].
Assuming ch
is a signed char
and you try to store the value 128 in it, then pass it to isalpha
, the left hand side of the assertion is going to evaluate to a very large number, causing it to fail.
128 can't be stored in a signed char
, so the value of ch
actually becomes -128, which is the signed representation of unsigned 128 (1000 0000 in binary). isalpha
is taking ch
as an int
, so the (c + 1)
is actually (-128 + 1)
, which becomes -127. This value is then cast to an unsigned integer, which turns into a very large value.
A solution is to change ch
in your code to an unsigned char
, if it's possible that it's value can be greater than 127.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…