const, volatile, etc [LONG]

Henry Spencer henry at utzoo.uucp
Tue Dec 6 07:46:04 AEST 1988


In article <319 at aber-cs.UUCP> pcg at cs.aber.ac.uk (Piercarlo Grandi) writes:
>...C has been beautifully designed so as to allow for a simple
>compiler that does not do aggressive code optimization...

However, it is a verifiable fact that in general your code runs faster
if your C compiler does aggressive optimization.  Many (not all) of
the things an optimizer can do can be done by a C programmer, *if* he
has enough time and patience to do a lot of fussy, boring bit-picking.
In practice, programmers understandably prefer to leave that to the
compiler, and simply don't bother doing it if the compiler can't.

Another point which should not be overlooked is that code that has been
micro-optimized in this fashion tends to be (a) quite machine-specific
(it may work on another machine, but the micro-optimizations will be
all wrong), and (b) grossly unreadable.
-- 
SunOSish, adj:  requiring      |     Henry Spencer at U of Toronto Zoology
32-bit bug numbers.            | uunet!attcan!utzoo!henry henry at zoo.toronto.edu



More information about the Comp.lang.c mailing list