Board index » cppbuilder » Alignment

Alignment


2003-09-13 12:04:25 AM
cppbuilder33
Hi everybody:
I am reading from with a alignment in memory of 32-bits. To understant the
values in my application i create one struct to access to the value
obtained. Now, I compile my application with a alignment in Borland of
Bytes. But with this alignment i need to put fields of padding in my struct
( type of char padding[2]). I have proved with an alignment of double-word
(32bits) and without fields of padding , but with this alignment i canīt
read the fields correctly. I donīt understand this because i think that i
set the same alignment that at memory. Can sombebody help me?
Thanks very much
Antonio
 
 

Re:Alignment

"Antonio Farfan" < XXXX@XXXXX.COM >wrote in message
Quote
I donīt understand this because i think that i set the
same alignment that at memory. Can sombebody help me?
Please show your actual code.
Gambit
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (www.grisoft.com).
Version: 6.0.515 / Virus Database: 313 - Release Date: 9/1/03
 

Re:Alignment

Quote
I am reading from with a alignment in memory of 32-bits.
Where are you reading from?
Quote
Now, I compile my application with a alignment in Borland of
Bytes. But with this alignment i need to put fields of padding in my struct
( type of char padding[2]).
Instead of changing the alignment compiler option for the entire
project, it probably makes more sense to use #pragma's to specify the
alignment for this one structure.
See #pragma pack and #pragma pop. There is an example here.
www.bcbdev.com/faqs/faq44.htm
H^2
 

{smallsort}