On Sunday 12 March 2006 10:33, Axel Weiß wrote:
> Steven T. Hatton wrote:
> > i386 (32-bit version), i486, P, PII, PIII, P4...
> > #include <iostream>
> > int main() {
> > char c('c');
> > std::cout<<c<<std::endl;
> > }
> >
> > Assume char is 8-bits. The smallest retrievable unit of storage is a
> > 32-bit word. That means the CPU puts c in a 32-bit word. What will
> > occupy the other 24 bits of the word?
>
> This statement is not correct. The 32-bit property, regarding i386
> architectures, means that 32 bit units _can_ be accessed (because the
> physical bus interface has 32 bits width). However, i386 _adresses_
> 8-bit units and stores them byte-by-byte. You can easily store four
> bytes into a 32 bit integer variable.
See the last diagram on this page:
http://tinyurl.com/qc8wq
http://www.intel.com/software/products/compilers/flin/docs/main_for/mergedprojects/optaps_for/fortran/optaps_prg_algn_f.htm
You /can/ tell the compiler to go ahead and pack the data as tightly as
possible by ignoring natural alignment boundaries, but doing so will probably
have a significant negative impact on performace.
Steven
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]