Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
Newsgroups: comp.lang.c++
Subject: Re: What does the "L" mean
Date: Fri, 06 Dec 2019 22:36:20 -0800
Organization: A noiseless patient Spider
Lines: 38
Message-ID: <86v9qs4p7f.fsf@linuxsc.com>
References: <875zivzhd9.fsf@bsb.me.uk> <87zhg6yekm.fsf@bsb.me.uk> <87o8wkyel2.fsf@bsb.me.uk>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: reader02.eternal-september.org; posting-host="dc2463479761dea98da7667c87edc47e"; logging-data="15778"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Rc4m7vLBB5zZqCKd1TwLK0YRRdsfv4V8="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:Krep/z5GeAwfHUemf2zZCoNM+xU= sha1:Lb4EeGZjO2o1y0j/eqq95qdWuic=
Xref: csiph.com comp.lang.c++:70328
Ben Bacarisse writes:
> Vir Campestris writes:
>
>
>>>>> Vir Campestris writes:
>>>>>
>>>>>
>>>>>> The one that really strained C was the one where incrementing a
>>>>>> pointer by 1 went to the next bit. Not byte or word. (TI GPU)
>
>
>
>> BTW the Dec10 - the 36 bit one I used - an int was 36 bits, but a
>> character string was stored as set of 5 7-bit ASCII characters plus
>> one pad bit in each word... Never used C on it though.
>
> It would be very expensive to implement C using that packed format for
> character strings. Some C implementations on other word addressed
> machines decided to make char one word; on others arithmetic was needed
> to convert between word and "char" pointers. It's notable that,
> programmer assumptions aside, word addressed machines are probably more
> awkward for C the bit-addressed ones.
The PDP-10 had a special representation for pointing to, and
accessing, "bytes" within a word, and instructions for doing loads,
stores, and pointer arithmetic in terms of "bytes" rather than
words. A nice thing about the PDP-10 byte pointers is the width in
bits of a "byte" is part of the stored representation in each byte
pointer. A C implementation on a PDP-10 could choose 9-bit bytes
for 'char' without too much trouble[*]. Alternatively, for a bit of
fun, bytes could be 12 bits, with two bytes for int's, and three
bytes for long (no longer works for C11, naturally), and two 36-bit
words for long long. But 9-bit bytes would work just fine, even for
C11. (Sorry folks - no uint32_t in those implementations.)
[*] IIRC, "bytes" in the PDP-10 were treated as unsigned, so
signed types would need sign extension on loading.