[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xerces-c-dev
Subject:    Re: How do I use Xerces strings?
From:       "Steven T. Hatton" <hattons () globalsymmetry ! com>
Date:       2006-03-13 5:03:50
Message-ID: 200603130003.51235.hattons () globalsymmetry ! com
[Download RAW message or body]

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: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic