Pascal not considered harmful - was Re: Rich kids are into COBOL

Johnny Billquist bqt at update.uu.se
Fri Feb 20 19:42:58 CST 2015


On 2015-02-21 02:26, Chuck Guzis wrote:
> On 02/20/2015 04:44 PM, ben wrote:
>
>> How do handle byte operations in C like *x++ on a PDP 10?
>
> I'm only passingly familiar with fORTRAN on the PDP-10, not C.  But the
> tapes that I've worked with packed 5-7 bit characters into a word with a
> bit left over.  In C, does an int have to be an exact number of chars long?
>
> But, for that matter, how do you handle byte operations if they're not 6
> bit/12 bit on a CDC 6600 in c? (60 bit words).

Misunderstanding 1: a char do not need to be 8 bits.

Also, an int is defined to be whatever size makes most sense on a 
machine. It can be any number of bits. The only thing guaranteed is that 
an int is between a short and a long in size. (They can all be equal.)

All that said, much C code make way more assumptions than the standard 
allows. Plenty of sloppy programmers around.

And all that said, I do think the basic "unit" must be the same in all 
places. So if you report sizeof as 9-bit chunks somewhere, it needs to 
be 9-bit chunks everywhere else as well.
So you cannot have sizeof(int) == sizeof(char), unless they actually 
contain the same number of bits. And since sizeof returns an integer, 
you pretty much also needs to make one a multiple of the other as far as 
number of bits goes.

	Johnny

-- 
Johnny Billquist                  || "I'm on a bus
                                   ||  on a psychedelic trip
email: bqt at softjar.se             ||  Reading murder books
pdp is alive!                     ||  tryin' to stay hip" - B. Idol


More information about the cctalk mailing list