Another noalias objection & suggestion

Jon 'Quality in - Quantity out' Foreman physh at unicom.UUCP
Wed Jan 27 21:29:47 AEST 1988


	I keep hearing about how this and that is good or bad from
an implementation point of view.  It's important to remember that 
there are people who have to maintain code too.  This brings up
noalias.

	The compiler can find and flag misuses of the register keyword,
but the design of noalias when used the correct way may make otherwise
wonderful code *much* harder to update or maintain, since the compiler
and lint will have no good way (or way at all maybe) to warn the
maintainer that he may be running into problems.  This is compounded
for large programs where you are changing code in one file which
references a noaliased variable defined in an include file or other
place.

	Most noalias bugs will tend to be "quiet."  You won't get a
SEGV or BUS error, your output will just be wrong, or your loop won't
go the right number of times.  An alias to a noaliased variable is
still "valid", at least in the sense that it is defined and has
storage.  It will simply not be synchronized with the noalias
version.

	There is also the case where the hint you give the compiler
with noalias is mistaken, due to misunderstanding or a simple slip.
Errors of this type will make the compiler appear to "break" in
unexpected ways, and may give people an active distrust of their
compilers.  It is unclear whether this problem will even be very
visible in the debugger.

	I am very much against noalias and I would ask the ANSI
committee to consider leaving it out for this round of the
standardization.  If they insist that it has to be in, I would ask that
they add a clause that states that noalias is only active on compiles
that have the "optimize" flag to the compiler set.  This would give one
a "way out" to at least see if the code works at all before assuming
the worst.  Since noalias is an optimization anyway, it wouldn't really
be inconsistent usage.

	Jon Foreman

-- 
ucbvax!pixar!\            | For small letters  | ~~~~~~~\~~~   That's spelled
hoptoad!well!unicom!physh | ( < 10K ) only:    |  Jon  }()      "physh" and 
       ptsfa!/            | physh at ssbn.wlk.com |        /     pronounced "fish".



More information about the Comp.lang.c mailing list