Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Feb 2015 00:33:25 -0800 (PST)
From:      Don Lewis <truckman@FreeBSD.org>
To:        allbery.b@gmail.com
Cc:        erichsfreebsdlist@alogt.com, freebsd-stable@FreeBSD.org, kpneal@pobox.com
Subject:   Re: top, fixed buffer length in utils.c
Message-ID:  <201502130833.t1D8XPkI036074@gw.catspoiler.org>
In-Reply-To: <CAKFCL4VX4DWxtVV_6SdG2ERiVwA=V%2BaXgaKvEg69z76R=f4Xag@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 13 Feb, Brandon Allbery wrote:
> On Thu, Feb 12, 2015 at 10:50 PM, <kpneal@pobox.com> 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.




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