const, volatile, etc

Doug Gwyn gwyn at smoke.BRL.MIL
Sun Dec 11 16:00:37 AEST 1988


In article <10988 at ulysses.homer.nj.att.com> cjc at ulysses.homer.nj.att.com (Chris Calabrese[mav]) writes:
>If the variables
>can all be optimized out of loops, etc, how come the machine
>I'm working on, which has a memory bit-mapped screen,
>memory mapped keyboard, etc - whith all the drivers written
>in Classic C - possibly work?

Well, first of all you're probably using a compiler that doesn't
optimize very highly, and possibly when compiling the kernel the
cc -O option is NOT used, to further restrict the amount of
optimization.

If it's a PDP-11 or VAX PCC, then there is an explicit check for
*(pointer_cast)(device_space_address) usage, and certain optimizations
are disabled if it can be determined that the I/O page may be accessed.
I don't know whether something similar is done for other architectures.

"volatile" would have been a much better solution..



More information about the Comp.lang.c mailing list