General gcc4.0 porting guide

Matthias Saou thias at spam.spam.spam.spam.spam.spam.spam.egg.and.spam.freshrpms.net
Fri Apr 29 13:32:02 UTC 2005


Hans de Goede wrote :

> >>[...]
> >>((short int*)foo)++;  // gcc4 does not like this.
> > 
> > 
> > 1) Fix the code in question (why is there a cast to short) ;-)
> > 
> > 2) perhaps:
> > 
> >   *foo = ((short int) (*foo)) + 1;
> 
> No, the original code moved the ptr your code instead changes the 
> contents of what is pointed to.
> 
> Correct would be:
> foo = (int *)((short int *)foo + 1);

Hmmm, so I guess the patch I've made for libmpeg3 is wrong. What would the
proper fix for this be, then?

      *((unsigned short*)data)++ = \
               ((CLIP(r_l) & 0xf8) << 8) | \
               ((CLIP(g_l) & 0xfc) << 3) | \
               ((CLIP(b_l) & 0xf8) >> 3);

Matthias

-- 
Clean custom Red Hat Linux rpm packages : http://freshrpms.net/
Fedora Core release 3 (Heidelberg) - Linux kernel 2.6.11-1.14_FC3
Load : 0.89 0.76 0.53




More information about the fedora-extras-list mailing list