Will, I think I qualify as one of "most of us". And it would break many
things I do if the system stripped unreferenced resources. It is not unusual
for me to iterate through a sequence of resources using an indirect
reference. The compiler/linker would have to be pretty smart to figure what
the initial and terminating value of the DmResID are, and what my
incrementing value is...


/fn

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Mark
Wilden
Sent: Tuesday, June 06, 2000 8:26 AM
To: Palm Developer Forum
Subject: Re: CodeWarrior Dead Code Optimizations


"Gordon, Douglas" wrote:
> 
> >From: Mark Wilden <[EMAIL PROTECTED]>
> 
> >but it doesn't sound like
> >rocket science to strip out resources whose IDs (the identifiers
> >used in the .rcp) are only referenced by dead code.
> 
> In fact, it would be extremely difficult to do this.

It would be _impossible_ to do this in a way that would satisfy all
cases. I think it would be quite possible to do this in a way that
matches the way most of us code.

> First off, Codewarrior
> does not really "know" anything about how PalmOS works. If it generates a
> resource symbol, say symbol LowMemAlert with an ID of 1020, to the
compiler
> this is simply a C preprocessor symbol assignment.

I'm not a CodeWarrior user, but it creates resource IDs itself, doesn't
it? And stores them in a place it knows about? It sounds like you're
trying to put all the burden on the CodeWarrior compiler, when in fact
that's not the proper place for this functionality.

> Basically, the compiler cannot look at a piece of code to determine what
> symbols or values in the code have significance to another section of the
> program. If you think about what is going on when you compile a program,
you
> should start to understand the point that I am trying to make. As someone
> else stated, this is a class of problem in computer science that is
related
> to the famous "halting" problem -- it is truly intractable.

Only because you're thinking about a perfect solution (which I agree is
intractable), not merely a useful solution.

Given that it's possible for CodeWarrior to identify dead code, it is
possible for it to identify places in that code where certain
preprocessor defines are used. If it finds that those defines are _only_
used in that dead code, it is possible for it to strip the associated
resources out of the executable.

I maintained a compiler (for a proprietary language) for about five
years. I know that this can be done. Whether it's important enough to
warrant doing, however, is another matter. :)


-- 
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/

Reply via email to