Re: [AD] BCC32 broken under Beta 4

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On 2005-08-11, Matthew Leverton <meffer@xxxxxxxxxx> wrote:
> > The cast was to fix a const-correctness warning, but I don't see why.
> > 
> But even if I remove the cast it still doesn't work with BCC32. It
> doesn't like it being passed as a parameter. If I rename the first
> parameter of the function to something else (to switch to the global
> list_getter) or just use NULL it compiles.

Oops, I didn't see that.  The problem is probably that BCC32 doesn't
like non-constant initialisers (new to C99).  See patch.

Peter
Index: tools/grabber.c
===================================================================
RCS file: /cvsroot/alleg/allegro/tools/grabber.c,v
retrieving revision 1.82
diff -u -r1.82 grabber.c
--- tools/grabber.c	2 Aug 2005 17:42:53 -0000	1.82
+++ tools/grabber.c	11 Aug 2005 08:56:54 -0000
@@ -3625,7 +3625,7 @@
       /* (dialog proc)     (x)   (y)   (w)   (h)   (fg)  (bg)  (key)    (flags)     (d1)           (d2)     (dp)                 (dp2) (dp3) */
       { d_shadow_box_proc, 0,    0,    224,  113,  0,    0,    0,       0,          0,             0,       NULL,                NULL, NULL  },
       { d_ctext_proc,      0,    2,    220,  15,   0,    0,    0,       0,          0,             0,       NULL,                NULL, NULL  },
-      { d_list_proc,       28,   24,   161,  50,   0,    0,    0,       0,          0,             0,       (int(*)(int,DIALOG*,int))list_getter,         NULL, NULL  },
+      { d_list_proc,       28,   24,   161,  50,   0,    0,    0,       0,          0,             0,       NULL/*list_getter*/, NULL, NULL  },
       { d_button_proc,     16,   80,   81,   17,   0,    0,    13,      D_EXIT,     0,             0,       "OK",                NULL, NULL  }, 
       { d_button_proc,     127,  80,   81,   17,   0,    0,    27,      D_EXIT,     0,             0,       "Cancel",            NULL, NULL  }, 
       { NULL,              0,    0,    0,    0,    0,    0,    0,       0,          0,             0,       NULL,                NULL, NULL  }
@@ -3633,6 +3633,11 @@
    va_list args;
    char buf[1024];
    int ret, c;
+ 
+   /* Some compilers don't like non-constant initialisers */
+   ASSERT(datedit_select_dlg[2].proc == d_list_proc);
+   ASSERT(datedit_select_dlg[2].dp == NULL);
+   datedit_select_dlg[2].dp = list_getter;
 
    va_start(args, fmt);
    uvszprintf(buf, 1024, fmt, args);


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/