[net.lang.c] portability; bit*

alexc@dartvax.UUCP (01/04/85)

It isn't much of a portability argument that C runs on both  PDP-
11  and  370s.  Both are byte addressed, though I believe the 370
has more alignment constraints.

Contrast C implementation on a Honeywell  mainframe  (as,  I  be-
lieve,  Waterloo  has  done).  The machine is word addressed, not
byte  addressed.   However  there  are  string  instructions  and
pointers  which can index by a character count.  For that matter,
there are bit string instructions which can index by a bit count.
C  and  C programmers assume that the machine is easily character
addressed, but the language takes no notice of bit addressing.

I therefore propose that the bit type be added to C, with  atten-
dant bit*, bit[] bit(), etc.

gwyn@brl-tgr.ARPA (Doug Gwyn <gwyn>) (01/05/85)

I would love a bit data type for use as Booleans,
especially in Boolean matrices.

I don't see how this could be done without adding another
keyword to the language, and in this case it would
certainly conflist with variable/macro names widely
used in existing code.

ron@brl-tgr.ARPA (Ron Natalie <ron>) (01/05/85)

> It isn't much of a portability argument that C runs on both  PDP-
> 11  and  370s.  Both are byte addressed, though I believe the 370
> has more alignment constraints.
> 
> Contrast C implementation on a Honeywell  mainframe  (as,  I  be-
> lieve,  Waterloo  has  done).  The machine is word addressed, not
> byte  addressed.   However  there  are  string  instructions  and
> pointers  which can index by a character count.  For that matter,
> there are bit string instructions which can index by a bit count.
> C  and  C programmers assume that the machine is easily character
> addressed, but the language takes no notice of bit addressing.
> 
> I therefore propose that the bit type be added to C, with  atten-
> dant bit*, bit[] bit(), etc.

Actually, 370's are subject to about the same alignment considerations
as a VAX.  You don't have to align things, but it is a more efficient
memory access if you do.

If you really want horrors, try machines that have different address
formats for various data types.  Take the Denelcor HEP (take mine
please).  It has three address types.  One for bytes and another for
quarter, half, and full (64 bit words).  The non-byte address sort of
looks like the byte address except that if the lower three bits are 0
you are referring to the full word, 2 and 6 refer to the upper and lower
half word, and 1, 3, 5, and 7 refer to the quarter words.

-Ron

henry@utzoo.UUCP (Henry Spencer) (01/06/85)

> C  and  C programmers assume that the machine is easily character
> addressed, but the language takes no notice of bit addressing.
> 
> I therefore propose that the bit type be added to C, with  atten-
> dant bit*, bit[] bit(), etc.

Most machines are not too hard to address by the character.  In particular,
most any machine which is not saddled with 20 years of backward compatibility
addresses to the byte.  Efficient bit addressing is rather less common, and
not nearly as useful.  Doesn't seem worth a language change at this late date.
-- 
				Henry Spencer @ U of Toronto Zoology
				{allegra,ihnp4,linus,decvax}!utzoo!henry