Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 1 Feb 2015 17:51:59 +0800
From:      Erich Dollansky <erichsfreebsdlist@alogt.com>
To:        freebsd-stable@freebsd.org
Subject:   top, fixed buffer length in utils.c
Message-ID:  <20150201175159.7fa88d16@B85M-HD3-0.alogt.com>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150201175159.7fa88d16>