在Thinking C++ 中
while(!isalpha(*p) && p != end)
p++;
// Copy until the first non-alpha character:
while (isalpha(*p) && p != end)
should be
while( p != end && !isalpha((unsigned char)*p) )
p++;
// Copy until the first non-alpha character:
while (p != end && isalpha((unsigned char)*p))
isalpha只接受unsigned char的参数,如果是负数就会出错。