Re: [cc65] indirect load question...

From: Spiro Trikaliotis <ml-cc651trikaliotis.net>
Date: 2009-03-04 18:29:25
Hello Uz,

* On Wed, Mar 04, 2009 at 02:08:00PM +0100 Ullrich von Bassewitz wrote:
 
> Using "const" for optimizing is difficult, because the C standard does not
> guarantee that these values won't change. So "const" does not always mean
> "reads always the same value" in C.

Yes, I know. We would have to make cc65 a cc65pp (or cc++65)? ;)

However, the compiler could have determined that this is not the case.
Of course, this would not be trivial, and in many places, it might be
impossible.

However, the "struct in memory" approach is not different from the
peek kind of macros, as exactly the same thing (constants which are cast
to pointers) is used.

Another approach might be outside of C, with a linker file that defines
specific regions. I have not tested if it works better, but I highly
assume this.


Overall, it was just that I thought the compiler would optimize the
const pointer ("* const"), and I was surprised it did not. Having an
afterthought, it was obvious why the compiler did not try this rather
risky optimization.

Regards,
Spiro.

-- 
Spiro R. Trikaliotis                              http://opencbm.sf.net/
http://www.trikaliotis.net/                     http://www.viceteam.org/
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Wed Mar 4 18:29:46 2009

This archive was generated by hypermail 2.1.8 : 2009-03-04 18:29:48 CET