Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!nx01.iad01.newshosting.com!newshosting.com!news-out.readnews.com!news-xxxfer.readnews.com!s09-10.readnews.com!not-for-mail From: Patrick Scheible Newsgroups: comp.lang.c Subject: Re: Character Array vs String References: <3278969.27.1320842921986.JavaMail.geo-discussion-forums@prep8> <670026a6-8f9d-4112-bf32-444a3a5fd3f7@m7g2000vbc.googlegroups.com> <9hvlfpFe46U1@mid.individual.net> <9i270bFfdvU1@mid.individual.net> <3gjjc7hnnuum9md44djtindje5s4anh1om@4ax.com> <1c2dnbdXBN9MvFDTnZ2dnUVZ_i2dnZ2d@bestweb.net> Date: Sun, 27 Nov 2011 20:21:57 -0800 Message-ID: <86aa7gyize.fsf@zipcon.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.90 (berkeley-unix) Cancel-Lock: sha1:/zP5jkyI/m2KVtxBtmw9m7nc63o= MIME-Version: 1.0 Content-Type: text/plain Lines: 66 Organization: The Zip Connection (zipcon.net) NNTP-Posting-Host: 6eae52a0.news.zipcon.net X-Trace: DXC=:[fK`ZHIk074bbLLXId7?7U>Dm5d6:E6=IZHNl[f]g^7?ZjaKW[K5W0_A>1gcoFWo=YnoS=XB\4l5 X-Complaints-To: abuse@zipcon.net Xref: x330-a1.tempe.blueboxinc.net comp.lang.c:13991 "BartC" writes: > "Kenneth Brody" wrote in message > news:1c2dnbdXBN9MvFDTnZ2dnUVZ_i2dnZ2d@bestweb.net... >> On 11/21/2011 2:39 AM, David Thompson wrote: >> [...] >>> But to answer the exact question, DEC PDP-10 computers had a 36-bit >>> word with (few) special 'byte' instructions that could access *any* > >> While there were a few PDP-n's on campus as I recall, the main >> computer lab at the college I went to used a KL-10. While I hadn't >> heard of C way back when, I did some assembly programming on it. >> >> As you say, it had 36-bit words, and 18-bit addresses. The O/S used >> six 6-bit characters per word for filename, > > 'SIXBIT' format. Very handy, and probably also used for identifiers > for compilers (so you were limited to rather short names, but string > matching was very quick). > >> which IIRC were in 6.3 format. (I guess they used the other 18 bits >> for file attributes?) Text was typically stored as five 7-bit >> characters, with 1 bit padding. >> >> Yet, although addresses were 18 bits wide, and each address pointed >> to a 36-bit word, a "pointer" [could], in fact, be wider than 18 >> bits. For > > The address was 18-bits (for 256KWords of memory per task; just over > 1MB!). But there was also an 'indirect' bit which could be used for > repeated pointer operations, all automatic on any instruction. I > believe another 4-bits was an extra index register for each level of > pointers. > >> example, there were machine instructions for accessing sub-words, >> including things like "take the 7 bits at this address/bit-location, >> move it to the low-order 7 bits at this address, zero-padding it, >> and then increment the pointer by 7 bits". > > There were a dozen or so bits left over, which were used by > byte-pointers, but these needed special instructions to make use of. > >> (Of course, C requires at least 8 bits per char, so I guess it would >> use the same thing, but storing four 8-bit chars per word with 4 >> padding bits. You could store four 9-bit chars w/o any padding, but >> files on disk were 8-bit characters, so it probably wouldn't make >> sense to do so.) >> >> As I said, I never saw a C compiler for it, but I would suspect that >> sizeof() would be "interesting" on such a system. The simplest >> system would be to simply store one 8-bit char per 36-bit word, but >> that seems rather inefficient. > > I'd imagine C with it's various kinds of pointers would be a nightmare > to implement, if packed char arrays were to be used. I remember using > Pascal which offered a choice of unpacked (fast) or packed (slow) > arrays, records and (presumably) strings. There has been at least one C compiler for the PDP-10. It uses four 9-bit chars per word. The biggest model of PDP-10 supported extended addressing, with 23 bit wide addresses. That is word addresses, multiply by 4.5 to get the capacity in 8-bit bytes. -- Patrick