From: utzoo!decvax!cca!ima!n44a!dan Newsgroups: net.lang.c Title: C and real hardware Article-I.D.: n44a.144 Posted: Wed Apr 27 15:34:30 1983 Received: Thu Apr 28 05:47:51 1983 In C code such as device drivers, one often encounters code like: while (ADDR->c_reg&BUSY) ; where one is testing bits of a hardware device register, and waiting for a change. In there anything in the C specification which would prevent a good (but obviously not perfect) optimizer from reading the value of the device register just once, stuffing it into a CPU general purpose register and looping on its value ? I have noticed that at least some of the 4xbsd makefiles seem to purposely avoid the optimizer - is this sort of thing the reason ? Might not C benefit from some additional type (e.g. "unregister") which would tell an optimizer what was up. I believe DEC's MicroPower Pascal has a type called "volatile" which prevents this sort of thing. Dan Ts'o