Re: [cc65] const/volatile

Date view Thread view Subject view

From: Marc 'BlackJack' Rintsch (marc_at_rintsch.de)
Date: 2003-02-02 01:21:40


On Saturday 01 February 2003 17:06, Christian Krüger wrote:

> [...] Because I program 'a little bit object oriented' even
> in 'C' I have many 'getters' & 'setters'. So the function bodies of
> approx. 20% of my functions looks like this:
>
> --8<----
>
> void __fastcall__ setAnyData(const unsigned char anydata);
>
> setAnyData:
>       sta anydata
>       rts
>
> --8<----
>
> When writing to daughter chip registers (like setting colors,
> doing sound etc.) the same is true...
>
> There are much more functions possible on 65(S)C02, thanks
> to the 'stz'-instructions, where clearing a given table (pointer
> in accu/x) won't corrupt the accu...
>
> But maybe I should use my energy for writing an enhanced optimizer
> which will support this feature... ;-)

I like object oriented style too and for very simple getters/setters I 
use macros. This way you even spare that 'rts' and don't need any fancy 
compiler extensions.

Ciao,
	Marc 'BlackJack' Rintsch
-- 
There are perhaps 5% of the population that simply *can't* think.
There are another 5% who *can*, and *do*.
The remaining 90% *can* think, but *don't*.
-- R. A. Heinlein

----------------------------------------------------------------------
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 : 2003-02-02 01:24:23 CET