On 26 Apr 2006, Gabriel Dos Reis wrote: > <[EMAIL PROTECTED]> writes: > > | It is gcc 4.1.0, --target=arm-elf compiled on an Intel platform and > | GNU/Linux. > | > | The following construct: > | > | void *p; > | > | ((char *)p)++; > | > | makes the compiler to issue an error message, namely > | "invalid lvalue in increment" > | > | The ((char *)p) construct is perfectly valid object, a char pointer which > | can be lvalue and rvalue alike. For some reason gcc 4.1.0 (and 4.0.2 as > | well) treats ((SOME_TYPE *)p) as if it could not be an lvalue; > > indeed, it is not; in any ISO C version I know of.
OK - my bad. Wrote first thought later. Old gcc accepted the construct and legacy code broke on the new compiler. My sincere apologies. The question, however, remains: (how) can I tell the compiler to treat a pointer declared as void *p; as if it was a SOME_TYPE *p pointer without introducing temporaries? Sorry again, Thanks, Zoltan