This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
pointer arithmetic for alignment on short or int boundry
- From: Andy Howell <spam-andy-be-howell-gone at austin dot rr dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Sun, 21 Sep 2003 08:52:56 -0500
- Subject: pointer arithmetic for alignment on short or int boundry
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