From owner-freebsd-stable@FreeBSD.ORG Mon Feb 2 06:32:07 2015 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 246A79F0 for ; Mon, 2 Feb 2015 06:32:07 +0000 (UTC) Received: from alogt.com (alogt.com [69.36.191.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EA973279 for ; Mon, 2 Feb 2015 06:32:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=alogt.com; s=default; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To:From:Date; bh=/Hv4TqTH/34mdg87P6oSzE5VGtlO9zXITids/1Y9qN0=; b=dcim1aMBvH0wtWHxYYvVEsEoqiBL5UBXuGtxEIeTg10UKND4pyoH1YXjmg1EW8NE1XMNhW01E19NDnlgsA6iclf9sU2MYLtLSVmy9iF0iU3aHpASpHBZmKGSM8SMiCl4yM+mlW/fJJ7+jKmPEg2d6KlKG0EExg0wLCNbUqUs5Ss=; Received: from [114.121.160.30] (port=56193 helo=B85M-HD3-0.alogt.com) by sl-508-2.slc.westdc.net with esmtpsa (TLSv1.2:AES128-GCM-SHA256:128) (Exim 4.84) (envelope-from ) id 1YIAYB-000Vg3-Bj; Sun, 01 Feb 2015 23:32:00 -0700 Date: Mon, 2 Feb 2015 14:31:53 +0800 From: Erich Dollansky To: kpneal@pobox.com Subject: Re: top, fixed buffer length in utils.c Message-ID: <20150202143153.51638086@B85M-HD3-0.alogt.com> In-Reply-To: <20150202023709.GA28422@neutralgood.org> References: <20150201175159.7fa88d16@B85M-HD3-0.alogt.com> <20150201195722.68845794@akips.com> <20150201211125.2fb21c39@B85M-HD3-0.alogt.com> <20150202023709.GA28422@neutralgood.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - sl-508-2.slc.westdc.net X-AntiAbuse: Original Domain - freebsd.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - alogt.com X-Get-Message-Sender-Via: sl-508-2.slc.westdc.net: authenticated_id: erichsfreebsdlist@alogt.com X-Source: X-Source-Args: X-Source-Dir: Cc: freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Feb 2015 06:32:07 -0000 Hi, On Sun, 1 Feb 2015 21:37:09 -0500 kpneal@pobox.com wrote: > On Sun, Feb 01, 2015 at 09:11:25PM +0800, Erich Dollansky wrote: > > the problem is that top is not a x86 only program but should work on > > all platforms. Leaving this like it is might will cause problems > > when int becomes more than 32 bits wide. > > > > Of course, if it is known that the value to be converted will > > always be within 32 bits, it is not a problem to do it as it is > > done. > > Isn't it a bit early to be preparing for 128-bit processors? > aren't 64 bit sufficient to cause a problem? > And, even on an LP128 processor, the emerging _int128 type should be > sufficient to prevent int from having to grow larger than 32 bits. > > Seriously, int is 32 bits in size and there is no problem with > assuming this is true. If you like, int can be replaced with int32_t. > Then when LP256 processors are invented long after we're all dead the > code will still be working. > C does not define int to be 32 bits in width. It just happens that the compilers in use prefer 32 bits. I just prefer in my own code to be on the safe side. A small change here would help in case of. Erich