From: Ullrich von Bassewitz (uz_at_musoftware.de)
Date: 2003-03-15 14:01:13
On Fri, Mar 14, 2003 at 11:26:54PM +0100, Maciej Witkowiak wrote: > As you see the commented-out part allowed for easy initialization of > structures while the current one requires lots of unnecessary names > (myIcon1, myIcon2 and myIconTable won't be used anymore). And the worst thing is that it doesn't even work:-) > Is it possible to code in that commented-out way with current cc65? I don't > know if it was a bug or support for it was removed at certain point and what > standards it violated but it seemed useful. The problem in this case is not with the compiler but with the struct declarations. What the GEOS DoIcon routine expects is an equivalent of the following: struct icontab { char number; struct pixel mousepos; struct icondef tab[]; }; However, what is declared in the header file is this: struct icontab { char number; struct pixel mousepos; struct icondef* tab; }; As you can see, you're mixing up an array of structures, and a pointer to such a structure (or an array of structures). The initialization data you are using is data to initialize the first (correct) struct. An error in older compiler version caused it to not distinguish between compound types (arrays and structures) and pointers to these types. This is the reason why the compiler didn't detect the mismatch between the initialization data and the actual struct definition. Because the data type was wrong but the initialization data was correct, and the GEOS routine called didn't care about the data type, only about the actual data, the code worked. Now, since the error in the compiler is fixed, the compiler complains (correctly) about the mismatch between the struct and the data used to initialize it. The obvious solution is to fix the struct definition in gstruct.h. 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.
This archive was generated by hypermail 2.1.3 : 2003-03-15 14:02:04 CET