Re: [cc65] # of local variables allowed?

Date view Thread view Subject view

From: Ullrich von Bassewitz (uz_at_musoftware.de)
Date: 2001-03-02 19:45:37


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.

Regards


	Uz


--
Ullrich von Bassewitz                                  uz_at_musoftware.de
----------------------------------------------------------------------
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