top, fixed buffer length in utils.c

John Baldwin jhb at freebsd.org
Wed Feb 18 15:11:47 UTC 2015


On Tuesday, February 17, 2015 09:51:00 PM kpneal at pobox.com wrote:
> TL;DR: we shouldn't go littering our source tree with portability crap
> just to handle a case (64 bit ints) that is probably many, many years in
> the future.

Yeah, but I think char buf[sizeof(int) * 3 + 1] is actually less crappy than
char buf[10] despite it being more portable.  It is more obvious to the reader
what is happening.  Magic numbers are the least obvious thing to read and 
require more work for the reader to understand (hence needing a mult-line 
block comment to explain in this case).

-- 
John Baldwin


More information about the freebsd-stable mailing list