I know word ailgnment alighns things but why is it just to make things run quicker, ie quicker access to the data members.
thanks for the help.
I know word ailgnment alighns things but why is it just to make things run quicker, ie quicker access to the data members.
thanks for the help.
THanks salem but... is that it or is there more to it, oh and why
Last edited by anthonye; 07-09-2003 at 11:07 AM.
Yup, that's pretty much it. Assuming your using an Intel-based PC, you'll find that the Intel CPU is 32-bit, and has 32-bit registers and therefore likes doing things in 32 bits. So, it's faster to play with memory like that also - eg. locations 0, 4, 8, etc. AMD/VIA/etc are the same.
Windows by default aligns things on a quadword boundary for future compatibility, but most compilers stick to either word or dword alignment.
Now, 8-bit processors like the PIC Microcontrollers, don't care about alignment, but that's because they only access memory in 8-bit mode, not the 32-bit mode of the Intel (for example).