pointer arithmetic for alignment on short or int boundry

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I need to calculate an address on a short or int boundry. For some reason this is not working:

char *a;

a = (a + 1) & ((char*) -2));

Gcc 3.3 on Solaris complains:

error: invalid operands of types `char*' and `
   char*' to binary `operator&'

Why shouldn't I be able to mask off the low bit?

Thanks,

Andy


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux