Re: [cc65] declaring variables after code

From: Spiro Trikaliotis <ml-cc651trikaliotis.net>
Date: 2010-04-23 09:25:25
Hello,

* On Thu, Apr 22, 2010 at 03:54:31PM -0700 Steve Davison wrote:
> I just deduced that cc65 does not allow variables to be defined
> in a scope after code has been encountered...
 
> I haven't found  mention of this limitation in the docs or
> archives, and it is valid in C99 standard.

Yes. Unfortunately (at least for you), cc65 does not target C99, but
C89/90, where this is not allowed.

> It seems to make
> it impossible to ever declare a variable in a for loop header,
> even though that new variable has a scope internal to the loop.

You mean something like

  for (int i = 0; i < 99; i++)

?

This is not even allowed in C99 (but in C++, but this is a completely
different language!)

What is possible, however, is to use
   for (...)
   {
      int somedummy;
      ...
   }


HTH,
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 Fri Apr 23 09:25:37 2010

This archive was generated by hypermail 2.1.8 : 2010-04-23 09:25:40 CEST