Re: [cc65] Issue with an initializer using the address of an automatic variable

From: Spiro Trikaliotis <ml-cc651trikaliotis.net>
Date: 2008-02-11 09:48:12
Hello Uz,

* On Mon, Feb 11, 2008 at 08:52:47AM +0100 Ullrich von Bassewitz wrote:
> 
> Good morning!
> 
> On Mon, Feb 11, 2008 at 12:28:55AM +0100, Oliver Schmidt wrote:
> > GCC and MS VC++ consider this fine while cc65 (recent snapshot) states:
> >
> > Error: Constant expression expected
> > Warning: Converting integer to pointer without a cast
> >
> > Is this a cc65 bug?
> 
> Actually two of them:-) For one, cc65 will not search in struct scope to
> resolve names. This is easily circumvented by writing &s.i.

But: i is NOT part of s, it is declared outside:

void main(void)
{
  int i;
  struct {
    int *p;
  } s = {&i};
}

Thus, I think your solution will not work here. (I HOPE not, as it would
be wrong, IMHO).

Regards,
   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 Mon Feb 11 09:49:54 2008

This archive was generated by hypermail 2.1.8 : 2008-02-11 09:49:57 CET