Hi, On Tue, 10 Feb 2015 17:14:41 -0600 Bob Willcox <bob at immure.com> wrote:> On Mon, Feb 02, 2015 at 04:33:07PM -0800, John-Mark Gurney wrote: > > Erich Dollansky wrote this message on Sun, Feb 01, 2015 at 17:51 > > +0800: > > > 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? > > > > Per others, int is currently 32bits on all platforms we support... > > > > I guess adding: > > CTASSERT(sizeof(int) <= 4); > > > > would help fix your concern? at least now the expectation is > > codified and if it breaks, the build will break.. > > > > -- > > John-Mark Gurney Voice: +1 415 225 > > 5579 > > > > If/when the size of an int ever changes from being 32 bits, top will > be the least of our worries! >if all dubious statements have asserts in place, nothing will be a worry until then. It is a very bad idea to assume a size for any type when the size can change between compilers. If you want, just read the old discussion regarding time_t. Erich
On Wed, Feb 11, 2015 at 8:13 PM, Erich Dollansky < erichsfreebsdlist at alogt.com> wrote:> It is a very bad idea to assume a size for any type when the size can > change between compilers. > > If you want, just read the old discussion regarding time_t. >I keep feeling like we should have learned *something* in the past 30+ years, instead of rehashing arguments used in the PDP11, and later the 8088, days. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
Erich Dollansky wrote this message on Thu, Feb 12, 2015 at 09:13 +0800:> On Tue, 10 Feb 2015 17:14:41 -0600 > Bob Willcox <bob at immure.com> wrote: > > > On Mon, Feb 02, 2015 at 04:33:07PM -0800, John-Mark Gurney wrote: > > > Erich Dollansky wrote this message on Sun, Feb 01, 2015 at 17:51 > > > +0800: > > > > 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? > > > > > > Per others, int is currently 32bits on all platforms we support... > > > > > > I guess adding: > > > CTASSERT(sizeof(int) <= 4); > > > > > > would help fix your concern? at least now the expectation is > > > codified and if it breaks, the build will break.. > > > > > > -- > > > John-Mark Gurney Voice: +1 415 225 > > > 5579 > > > > > > > If/when the size of an int ever changes from being 32 bits, top will > > be the least of our worries! > > > if all dubious statements have asserts in place, nothing will be a > worry until then.Feel free to submit a patch eliminating the size assumption... I'll review and commit it if/when you do... -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not."
On Thu, Feb 12, 2015 at 09:13:23AM +0800, Erich Dollansky wrote:> Hi, > > On Tue, 10 Feb 2015 17:14:41 -0600 > Bob Willcox <bob at immure.com> wrote: > > > On Mon, Feb 02, 2015 at 04:33:07PM -0800, John-Mark Gurney wrote: > > > Erich Dollansky wrote this message on Sun, Feb 01, 2015 at 17:51 > > > +0800: > > > > 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? > > > > > > Per others, int is currently 32bits on all platforms we support... > > > > > > I guess adding: > > > CTASSERT(sizeof(int) <= 4); > > > > > > would help fix your concern? at least now the expectation is > > > codified and if it breaks, the build will break.. > > > > > > -- > > > John-Mark Gurney Voice: +1 415 225 > > > 5579 > > > > > > > If/when the size of an int ever changes from being 32 bits, top will > > be the least of our worries! > > > if all dubious statements have asserts in place, nothing will be a > worry until then. > > It is a very bad idea to assume a size for any type when the size can > change between compilers. > > If you want, just read the old discussion regarding time_t.Oh, I've been around since ints were 8 bits (on really old stuff) and appreciate the issues. However my point wasn't that assuming the size is good, but that when ints change we will have lots more serious breakage is all. Bob -- Bob Willcox | You climb to reach the summit, but once bob at immure.com | there, discover that all roads lead down. Austin, TX | -- Stanislaw Lem, "The Cyberiad"