[cc65] "Incompatible pointer types" bug

From: Andreas Koch <email1kochandreas.com>
Date: 2007-03-03 21:30:38
Hi all,

i'm trying to a port a little game i wrote for a Z80 based machine to
the C64, using cc65.

I stumbled upon a problem:
--------------------------------------
#include <stdio.h>
#include <cbm.h>

typedef signed int   TypA[3];

typedef struct TypB    {
                         TypA Data[2];
} sTypB;


sTypB Bs[10];
TypA * APtr;



int main(int argc, char* argv[])

{
   Bs[7].Data[1][2]=11;
   APtr=&(Bs[7].Data[1]);

	printf("Hallo Welt! %i = %i \n",Bs[7].Data[1][2], (*APtr)[2] );
	return 0;
}
----------------------------------------
gives
test.c(20): Error: Incompatible pointer types
for   APtr=&(Bs[7].Data[1]);

My experience in C is very limited, but as this works both in MSVC and 
the 8 bit Z80 compiler i originally used, i guess its an bug in CC65.

As a workaround, an typecast via  APtr=(TypA*)&(Bs[7].Data[1]);
seems to work.

greetings,
   Andreas


----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Sat Mar 3 21:30:43 2007

This archive was generated by hypermail 2.1.8 : 2007-03-03 21:30:47 CET