top, fixed buffer length in utils.c

Don Lewis truckman at FreeBSD.org
Fri Feb 13 08:33:39 UTC 2015


On 13 Feb, Brandon Allbery wrote:
> On Thu, Feb 12, 2015 at 10:50 PM, <kpneal at 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.



More information about the freebsd-stable mailing list