Noalias trivia question
Dave Sill
dsill at nswc-oas.arpa
Wed Jun 22 01:37:05 AEST 1988
Peter J Desnoyers <peter at athena.mit.edu> writes:
>I realize that you may be able to come up with an
>approximation that is computable, but note that [you] must never fail to
>detect aliasing when it exists.
Yes, this is my point exactly. And it's very similar to what Chris
has been saying about `volatile'. I'd rather take a slight
performance hit to avoid a zillion modifiers like `volatile' and
`noalias' (who knows what will be next?) that can introduce subtle
bugs and complicate the language. I'm willing to wait until we have
compilers that can tell when aliasing is not possible or when
volatility is not possible, and optimize accordingly.
>I merely mean to point out that
>most programmers accomplish, through judicious foresight (and by
>avoiding gruesome code which the compiler is required to accept) tasks
>which the compiler must accomplish through extensive or even
>impossible checking.
Herein lies the difference in our opinions. My philosophy is that
anything that can be done by the compiler to make the programmer's job
easier or anything that can be done better by the compiler should be
done by the compiler. Why require all programmers to be concerned
with aliasing/volatility/etc when, let's face it, they are so likely
to either not bother with it, or, if they do, to do it wrong?
Probably better than 90% of all C programmers don't even have a good
grasp on the simple pointers of K&R C. I've seen too many people do
"char *p; ... strcpy (p, foo);", without pointing p at something
reasonable first, to have any degree of confidence in their use of
something like `noalias'.
Should we pander to the least common denominator? No, but neither
should we introduce keywords aimed at the very small number of C
programmers that would actually use them correctly, especially when
their misuse by the masses would be inevitable.
=========
The opinions expressed above are mine.
"We must remove the TV-induced stupor that lies like a fog across the
land."
-- Ted Nelson
More information about the Comp.lang.c
mailing list