This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Struct allocation on a 4 byte boundary: Syntax error?
- To: gcc-help at gcc dot gnu dot org
- Subject: Struct allocation on a 4 byte boundary: Syntax error?
- From: Gigi Sullivan <sullivan at sikurezza dot org>
- Date: Thu, 12 Oct 2000 21:55:15 +0200
Aiee :)
Hello!
I don't know if this is the right mailing list, so I apologize
if I'm wrong :)
I'm trying to allocate a struct on a 4 byte boundary but I get
error while compiling (gcc version 2.7.2.3).
I also don't know if I'm doing right ;)
Here attached here's the simple test program.
Any ideas?
Thx && bye bye
-- gg sullivan
--
Lorenzo Cavallaro `Gigi Sullivan' <sullivan@sikurezza.org>
LibRNet Project Home Page: http://www.sikurezza.org/sullivan
LibRNet Mailing List: librnet-subscribe@egroups.com
Until I loved, life had no beauty;
I did not know I lived until I had loved. (Theodor Korner)
#include <stdio.h>
struct foo {
int a;
int b;
char c;
};
int
main(void)
{
struct foo *foobar;
foobar = (struct foo *) malloc(sizeof(struct foo) + 3);
foobar = (struct foo *) (((char *) foobar + 3) & ~3);
exit(0);
}