Re: [cc65] volatile

Date view Thread view Subject view

From: groepaz (groepaz_at_gmx.net)
Date: 2002-04-12 19:12:27


Hello Stephan,

Friday, April 12, 2002, 7:02:42 PM, you wrote:

SL> Hi,

SL> and sorry if the following is an RTFM question... since the compiler ignores
SL> volatile variables, can I assume that it will generate a load/store from/to
SL> the address of a variable every time I access it? I'm thinking about zero
SL> page locations that get changed by a Rom routine I call, or memory locations
SL> I use as an interface with an external interrupt handler...

yes, they dont get optimized out .... i would however still declare
them as volatile, since you never know what future versions of the
compiler do ;)

as a rule of thumb, always remember that the compiler tries to be
ansi-compatible..... so in this case, "volatile isnt supported" means
that the compiler doesnt know about special optimizations specific to
volatile vs. non-volatile variables - other than that it produces code
that works as expected. (again, use the volatile keyword and forget
about what the compiler thinks about it ;=P)

-- 
Best regards,
 groepaz                            mailto:groepaz_at_gmx.net


----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2002-04-12 19:13:22 CEST