When you're talking about "perfectly" versus "for the majority" or "most of
the time" you're talking the difference between an algorithm and a
heuristic.
A heuristic is allowed to fail sometimes, and can still be mighty useful as
an aid to decision-making. But a heuristic whose failure mode is code that
mysteriously fails to function has absolutely no place in the code generator
of a compiler.
If you want to look for unused resources, then build an independent
code-checker that can aid you in deciding whether or not to include a given
resource in your program.
As a part of the compiler, it would be way too dangerous to ever use.
Imagine falling prey to the temptation to turn on the last bit of
optimization just before release, doing only a cursory test, to have your
users discover that the compiler had deleted all the error messages. Of
course, we're all professionals here and never fall prey to temptation...
> -----Original Message-----
> From: Mark Wilden [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, June 08, 2000 1:15 PM
> To: Palm Developer Forum
> Subject: Re: CodeWarrior Dead Code Optimizations
>
>
> Richard Hartman wrote:
> >
> > This hypothetical optimization would fall apart on some of my
> > code, where I do "resource math".
> >
> > I have a series of resources, starting at X. I have a status
> > represented by an enum (or integer). I then translate the
> > status to a displayable text string by calculating the resource
> > thus:
> >
> > int resid = BASE_ID + status;
>
> I've only said this about five times by now, but I guess I have to say
> it again: There is no practical way to do this _perfectly_, but it is
> quite possible to do it in a way that would work with the way
> most of us
> code.
>
> > Your optimization would strip out all of my displayable strings!
>
> I've also said this before: the optimisation would have to be
> configurable.
>
> I don't really care about this optimisation, nor can I imagine I'd use
> it. My only point was that just because tool X can't be
> perfect doesn't
> mean it can't work at all. We programmers, as binary beings, sometimes
> forget this more analog conception of quality.
>
>
>
> --
> For information on using the Palm Developer Forums, or to
> unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
>
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/