This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Why does gcc4 dislike this code?
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