top, fixed buffer length in utils.c

Erich Dollansky erichsfreebsdlist at alogt.com
Sun Feb 1 09:52:08 UTC 2015


Hi,

I came across this here in utils.c which is part of top:


/*
 * How do we know that 16 will suffice?
 * Because the biggest number that we
  will
 * ever convert will be 2^32-1, which
 is 10
 * digits.
*/

char *itoa(val)

register int val;

int can be 64 bits on a amd64 machine. Why is the author of this code
so sure that we will never cross the 32 bit boundary?

Erich


More information about the freebsd-stable mailing list