This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Passing an address to a #define in C


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]