On 16 Oct 2011 at 11:03, Toby Thain wrote:
Hence: bitfields, as mentioned above. Note that VAX-11
has native
bitfield instructions. I don't know if VAX C used them...
Not the same at all. I don't believe that in C I can declare:
bit anything[60000];
K&R have bitfields as comprising parts of larger datatypes, say int,
but not as a datatype in their own right. Can you imagine how
inconvenient it would be if the type "char" was available only as a
member of type "int"?
Bit arrays are enormously useful to facilitate vector math, either to
accompany sparse arrays or as a control vector for storing results.
And then there's the obvious application as a simple bitmap.
As I said, K&R C is extremely myopic and to my eye always appeared as
PDP-11 shorthand assembler. It's not as if bit vectors are anything
new; APL has had them for a very long time.
Another thing that's dogged me over the years is the extremely weak
preprocessor in C. To be sure, the template feature in C++ has
remedied a lot of it, but that's not C--it's C++. C's preprocessor
never came up to the level of the macro facility in a good macro
assembler or, for that matter, the preprocessor in PL/I.
Yes, I know the recommendation is to use a generic external macro
facility, such as M4 or a host of other tools, but none of those are
part of the C language.
What can be done with a really good macro-assembler is very eye-
opening. Sadly, not many newer assemblers, particularly those for
microcontrollers, have assemblers worth spitting at.
--Chuck