Re: Why does gcc4 dislike this code?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

walt wrote:
   *((unsigned long int *) tmp)++ = *((unsigned long int *) b1)++;

If you had to fix that code, how would you do it?

Maybe like in the following snippet?  It's ugly though.  Maybe you
need to rethink the whole thing and avoid such ugly hacks
altogether.

   unsigned long int *tmp_cast = (unsigned long int *)tmp;
   unsigned long int *b1_cast = (unsigned long int *)b1;
   *tmp_cast++ = *b1_cast++;
   tmp = (whatever_type1 *)tmp_cast;
   b1 = (whatever_type2 *)b1_cast;

jlh

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux