Passing an address to a #define in C
Andi Hellmund
mail@andihellmund.com
Tue Jun 21 16:25:00 GMT 2011
Hi Gus,
> This is because your code finally ends up with this expression:
> (void*)ptr>> 4
>
> and gcc doesn't allow the shift operation to be performed on pointer
> types. A possible solution to your problem could be the following code:
>
For the sake of completeness, if you're wondering why gcc requires an
integer type, please check the C standard:
6.5.7 Bitwise shift operators
[...]
Constraints
Each of the operands shall have integer type.
Best regards,
Andre-Marcel
More information about the Gcc-help
mailing list