gcc4 and casting lvalues
gcc4 and casting lvalues
- Subject: gcc4 and casting lvalues
- From: Sam Vaughan <email@hidden>
- Date: Fri, 14 Jan 2005 11:53:26 +1100
It appears that gcc 4 has an issue with casting lvalues:
% cat > test.c
#include <stdio.h>
int main()
{
void* vp = 0;
#ifdef A
(long*)vp += 1;
#endif
#ifdef B
vp = (long*)vp + 1;
#endif
printf("vp: %p\n", vp);
return 0;
}
% gcc-4.0 -DA test.c && ./a.out
test.c: In function 'main':
test.c:8: error: invalid lvalue in assignment
% gcc-4.0 -DB test.c && ./a.out
vp: 0x4
% gcc-3.3 -DA test.c && ./a.out
vp: 0x4
% gcc-3.3 -DB test.c && ./a.out
vp: 0x4
Is this expected behaviour? I might have a lot of code to change...
Sam
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden