On Mon, Sep 29, 2014 at 11:35 AM, Mouse <mouse at rodents-montreal.org> wrote:
the assumption of everything being made up of bits is
wired very
deeply into modern C - and to a nontrivial extent into even K&R C.
I dunno, as
I recall K&R C was - and is - just as bit oriented as
current gc$
So, what bits -:) of modern C are more wired into
the language?
First, let me dispose of the easy ones:
Auto-increment and -decrement are not bit-oriented; they make just as
much sense for PICTURE 999999 variables as for int variables - indeed,
any type for which addition and subtraction of small integers make
sense can support ++ and --. (Note that standard C supports ++ and --
applied to pointers and floating-point types.)
No C variant I'm aware of has rotates (though with the variety of
experiments out there, I'd be surprised if nobody had created one).
gcc's internal representation (in at least some versions) has rotates,
it's true, but (a) gcc's "C" is not actually C (it's C plus
various
extensions, at a minimum), and (b) gcc also supports a bunch of other
languages, at least some of which may well have rotates.
Bitwise operators and shifts are the interesting ones.
Modern C requires them to operate on unsigned integral types, and
signed integral types when the values in question are nonnegative, as
if they were represented in binary:
< discussion of ~, <<, >>, &, ^ and | >
As I understand the 1620, "operands" are variable length BCD. If we define
the C "int" as a single BCD digit, then the binary operators are straight
forward. Discuss: does a single BCD digit int produce a useful C
environment?
-- Charles