From owner-freebsd-stable@FreeBSD.ORG Fri Feb 13 08:33:39 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 5A17D7E0 for ; Fri, 13 Feb 2015 08:33:39 +0000 (UTC) Received: from gw.catspoiler.org (cl-1657.chi-02.us.sixxs.net [IPv6:2001:4978:f:678::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 02C39D08 for ; Fri, 13 Feb 2015 08:33:38 +0000 (UTC) Received: from FreeBSD.org (mousie.catspoiler.org [192.168.101.2]) by gw.catspoiler.org (8.13.3/8.13.3) with ESMTP id t1D8XPkI036074; Fri, 13 Feb 2015 00:33:29 -0800 (PST) (envelope-from truckman@FreeBSD.org) Message-Id: <201502130833.t1D8XPkI036074@gw.catspoiler.org> Date: Fri, 13 Feb 2015 00:33:25 -0800 (PST) From: Don Lewis Subject: Re: top, fixed buffer length in utils.c To: allbery.b@gmail.com In-Reply-To: MIME-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii Cc: erichsfreebsdlist@alogt.com, freebsd-stable@FreeBSD.org, kpneal@pobox.com 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: Fri, 13 Feb 2015 08:33:39 -0000 On 13 Feb, Brandon Allbery wrote: > On Thu, Feb 12, 2015 at 10:50 PM, wrote: > >> The case where int varies in size between platforms is distinct from the >> case where int varies in size between compilers on the same platform. If >> you reread what I wrote you'll see that I was addressing the latter case. >> > > C++ at least defines platform ABIs starting with C++11. If ANSI C does not > now, I suspect it will --- interoperability issues have come up before (for > example, in the early x86 days there were differences between how C > compilers packed structs. And in the *very* early x86 days there were > differences between compilers in the exact details of (int) and (long) and > pointer types in different memory models) and the result is that these days > there is usually (but not always) a de facto ABI for a platform. At least that's somewhat sane. My first real exposure to C was on a machine where int was 24 bits. I think short was as well. Long, float, and double were all 48 bits as I recall. Char was 8 bits, so having three chars in a word made char * arithmetic interesting. At least it could use ASCII. Porting "normal" software to that machine was lots of fun. If it would have had 6-bit characters like a machine that I used in my pre-C days would have made pointer arithmetic easier because four characters would have fit in a word, but that machine actually had 36-bit words. So far as I know, it never got a C compiler.