Re: GCC 4.0 "C" question
Re: GCC 4.0 "C" question
- Subject: Re: GCC 4.0 "C" question
- From: Steve Checkoway <email@hidden>
- Date: Mon, 31 Oct 2005 13:57:03 -0800
On Oct 31, 2005, at 11:43 AM, Mark Dawson wrote:
I'm taking on some older code, and I'm getting this warning:
"warning: target of assignment not really an lvalue; this will be a
hard error in the future"
for the following line:
*((uint32_t*)dst)++ = *((uint32_t*)src)++;
The real problem is with ((uint32_t*)dst)++ (and with ((uint32_t*)src)
++). The reason is that (uint32_t*)dst is not a valid lvalue;
however, *(uint32_t*)dst is.
Why is this code going to be an error in the future?
For now, I just replaced it with:
uint32_t *aligned32Src, *aligned32Dst;
aligned32Src = (uint32_t *)src;
aligned32Dst = (uint32_t *)dst;
*aligned32Dst++ = *aligned32Src++;
How about
*(uint32_t*)dst = *(uint32_t*)src;
dst = (typeof(dst))((uint32_t*)dst + 1);
src = (typeof(src))((uint32_t*)src + 1);
Where you would probably want to use the actual type of dst and src
in the case since typeof is a gcc extension.
- Steve
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden