Begginer Begginer - 1 month ago 9
C Question

What does isspace (ch & 0xff) mean?

I was reading a source code file. But I got stuck at the following line

while (isspace (* bp & 0xff))
++ bp;


I know the basic idea is to remove the spaces. But I don't know what
0xff
is exactly doing here in the following function.

static enum tokens scan (const char * buf)
{
static const char * bp;

if (buf)
bp = buf; /* new input line */

while (isspace (* bp & 0xff))
++ bp;

if (isdigit (* bp & 0xff) || * bp == '.')
{
errno = 0;
token = NUMBER, number = strtod (bp, (char **) & bp);
if (errno == ERANGE)
error ("bad value: %s", strerror (errno));
}
else
token = * bp ? * bp ++ : 0;

return token;
}

Answer

This operation is forcing zeros left of value.
[OR]
The operation *ch & 0xff select first 8 bits and isspace verify if value is space char.