[cc65] non-ANSI extensions and initialized structures

Date view Thread view Subject view

From: Maciej Witkowiak (ytm_at_elysium.pl)
Date: 2003-03-14 23:26:54


Consider this piece of code for GEOS (structure definitions are in
geos/gstruct.h, I won't quote them here):

---8<---

#include <geos.h>

void DoRect(void);
void DoFillRect(void);

const char image[] = {
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 };

// This is how it worked in summer 2000
//const struct icontab  MainIcons  = {(char)  2 , {(int)  0 , (char)  0 },
//	{	 
//	{ (char*)image , (char)  3 , (char)  48 , (char)  2 , (char)  16 , (int)  DoRect } ,
//	{ (char*)image , (char)  1 , (char)  48 , (char)  2 , (char)  16 , (int)  DoFillRect } ,
//	}
//};

// This is how it must be done with cc65 2.9.0
const struct icondef myIcon1 = {
     (char*)image , (char)  3 , (char)  48 , (char)  2 , (char)  16 , (int)  DoRect };

const struct icondef myIcon2 = {
     (char*)image , (char)  1 , (char)  48 , (char)  2 , (char)  16 , (int)  DoFillRect };

const struct icondef* myIconTable[] = {
    &myIcon1, &myIcon2 };

const struct icontab  MainIcons2  = {(char)  2 , {(int)  0 , (char)  0 },
	(struct icondef*)myIconTable
 };

---8<---

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).
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.

ytm

----------------------------------------------------------------------
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 : 2003-03-14 23:28:04 CET