Walt Mankowski on Thu, 24 May 2001 17:20:40 -0400 |
On Thu, May 24, 2001 at 04:59:30PM -0400, Mental wrote: > The main reason you've never heard of this so much is because its the > compilers job to do this. Sure, we could all be men and use punch cards, > or manually manipulate the inodes on the disk with a magnet, but I'm lazy. > I'd much rather let gcc worry about byte boundaries and alignment. So > would lots of other lazy people. Thats what the -m switches are for in gcc > :) I've run into issues exactly like this on other platforms. Imagine a structure that looks like this: struct foo { char c; int i; } It may look like i still start one byte after c, but in fact for performance reasons the compiler may decide to insert some filler so that i can start on an even-byte or perhaps a 4-byte boundary. We were moving some code from a 16-bit to a 32-bit box, and discovered that the compiler now wanted to line up int's on addresses divisible by 4 instead of by 2. Walt ______________________________________________________________________ Philadelphia Linux Users Group - http://www.phillylinux.org Announcements-http://lists.phillylinux.org/mail/listinfo/plug-announce General Discussion - http://lists.phillylinux.org/mail/listinfo/plug
|
|