Deutsch English Français Italiano |
<v6crb5$1gpa$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!feeds.phibee-telecom.net!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: James Kuyper <jameskuyper@alumni.caltech.edu> Newsgroups: comp.lang.c Subject: =?UTF-8?Q?Re=3A_technology_discussion_=E2=86=92_does_the_world_need?= =?UTF-8?B?IGEgIm5ldyIgQyA/?= Date: Sat, 6 Jul 2024 21:34:29 -0400 Organization: A noiseless patient Spider Lines: 30 Message-ID: <v6crb5$1gpa$1@dont-email.me> References: <v66eci$2qeee$1@dont-email.me> <v67gt1$2vq6a$2@dont-email.me> <v687h2$36i6p$1@dont-email.me> <v68sjv$3a7lb$1@dont-email.me> <v6a76q$3gqkm$6@dont-email.me> <87plrruvmt.fsf@nosuchdomain.example.com> <v6argi$3ngh6$5@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Sun, 07 Jul 2024 03:34:46 +0200 (CEST) Injection-Info: dont-email.me; posting-host="8e847e201f1ac6ac487c614b591508d8"; logging-data="49962"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/T00keG2mLYWX67y44Baztiw/J9kzubp8=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:pUW/mI2C3AdKY4/G36BH1lBsm40= Content-Language: en-US In-Reply-To: <v6argi$3ngh6$5@dont-email.me> Bytes: 2808 On 7/6/24 03:25, Lawrence D'Oliveiro wrote: > On Fri, 05 Jul 2024 19:00:58 -0700, Keith Thompson wrote: > >> C assumes byte addressibility, but it doesn't assume that bytes are 8 >> bits. >> >> The PDP-10 had 36-bit words and could operate on bit fields of any size >> from 1 to 36 bits. > > But it couldn’t address them. It doesn't matter whether there's hardware support for addressing bytes - byte addressing can be emulated in software on any platform sufficiently powerful to implement C's bitwise operators. To read a byte on a word-addressed machine where the word size is multiple bytes, just read in the word, then extract the bits that represent that particular byte. To write a byte on such a machine, read in the current contents of that word, replace the bits that represent that byte with their new values, and write the entire word back to memory. On many platforms, if _Alignof(type) is less than the word size, then a C pointer to that type is implemented as the combination of the machine address of the correct word, combined with an offset within that word of the first byte of that object. The existence of real world implementations that did this is the main reason that the C standard does not require that all pointers have the same representation. This may be inefficient, maybe sufficiently so to be a reason for avoiding using C on such a platform, but it doesn't (and hasn't) prevent the existence of a fully conforming implementation of C on that platform.