ANSII C, optimization, and "hardware registers"
tom at ucbcad.UUCP
tom at ucbcad.UUCP
Thu Oct 18 07:06:47 AEST 1984
I ran into some similar problems when I was writing a device driver. I
had to put in some weird kludges to make things work. MOST of my
problems could be solved by avoiding the optimizer, but not all. In any
case, I wanted to use the optimizer to tighten the code as much as I
could. I concluded that there should be a storage class that indicates
hardware side-effects.
I also thought it would be nice to have storage attributes for read-only
registers (I guess this is the "const" storage class in the proposed
ANSI standard -- I don't think much of the mnemonic value here, but I
suppose consistency is more important than mnemonics) and one for
write-only registers, so you would get a compile-time error if you tried
to read a write-only register or vice versa.
I'm sure there are other strange storage classes/attributes that people
would like to see in the standard. What do people think is a reasonable
set? I personally think the side-effect class is very important (IS
this in the proposed standard? I don't remember seeing it, but I may be
senile.), but the others are harder to justify.
Tom Laidig
More information about the Comp.lang.c
mailing list