Re: [cc65] # of local variables allowed?

Date view Thread view Subject view

From: Bryan Pope (bpope_at_wordstock.com)
Date: 2001-03-02 20:35:22


> 
> 
> Hi!
> 
> On Fri, Mar 02, 2001 at 01:25:56PM -0500, Bryan Pope wrote:
> > 	When trying to compile I get the error "Too many local variables".
> >
> > 	How many local variables are allowed?
> 
> The limit is 256 bytes total (parameters + locals + space for temporaries).
> The reason is that the stack is addressed using the Y register. Working around
> it would generate really awful code, since lots of additional calculations at
> runtime are needed.				
> 
> If your program has no recursive code. switching to static locals (via the
> --static-locals compiler switch) will usually fix the problem. Using static or
> dynamic memory (malloc/free) would be other possible solutions.
> 
Now I see my problem.. I am trying to compile a C program from another 
platform (Linux) which has a lot of ints.  Which are 16 bits here and would
use up those resources after only 16 variables.... Ooops...  I will just
rewrite this using chars.

Thanks!

Bryan

Another question:

Does malloc automatically use any ram expansion available?

----------------------------------------------------------------------
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 : 2001-12-14 22:05:39 CET