On Fri, Aug 29, 2003 at 08:05:33PM +0200, Leopold Toetsch wrote:
> Andy Dougherty <[EMAIL PROTECTED]> wrote:
> 
> > "closure.pmc", line 21: warning: a cast does not yield an lvalue
> 
> tcc fails totally. Its of cource me to blame :-)
> 
> What is the "official" way here:
> - don't do that, its really forbidden (why)

(IIRC) ANSI C forbits lvalue casts. (obviously) gcc is quite happy with these
IIRC HP-UX's C compiler and AIX's C compiler barf on these, with the result
that Merijn usually smokes these things out pretty quickly for perl5

> - create another macro acround that?

I think that the appended patch will work around the problem, by doing
the case on the pointer (which is an RVALUE) and then deferencing.
But currently I only have access to systems with gcc, so I can't test
on something pickier. (mmm. might be able to get x86 lcc installed
at some point)

Nicholas Clark

--- include/parrot/sub.h.orig   2003-08-29 21:09:19.000000000 +0100
+++ include/parrot/sub.h        2003-08-29 21:14:26.000000000 +0100
@@ -33,7 +33,7 @@ typedef struct Parrot_Sub {
     char *packed;       /* to simplify packing Constant Subs */
 } * parrot_sub_t;
 
-#define PMC_sub(pmc) ((parrot_sub_t)((pmc)->cache.pmc_val))
+#define PMC_sub(pmc) (*((parrot_sub_t *)&((pmc)->cache.pmc_val)))
 
 /* the first entries must match Parrot_Sub, so we can cast
  * these two to the other type

Reply via email to